• ubuntu16 配置git


    github上的开源项目,在ubuntu系统中无法进行clone,通过在网站上注册账户,用命令生成ssh 公钥和私钥,把公钥添加到网站账户中可解决这个问题

    1.产生ssh key

    ssh-keygen -t rsa -b 4096 -C "xuyuan_77@163.com"

    2.复制产生的pub key

    若没有安装xclip的话,先安装。命令如下

    sudo apt-get install xclip

    用命令复制:

    xclip -sel clip root/.ssh/id_rsa.pub

    然后再去github 网站上添加,网站上有帮助,就不细讲了。

    3.进行验证

     ssh -vT git@github.com

    4.把私钥加入ssh

    ssh-add ~/.ssh/id_rsa

    完整过程如下:

    root@ubuntu:~/.ssh# ssh-keygen -t rsa -b 4096 -C "xuyuan_77@163.com"
    Generating public/private rsa key pair.
    Enter file in which to save the key (/root/.ssh/id_rsa): /root/.ssh/id_rsa            注意:此处不要更改其默认目录,不然验证的时候找不到private key,以至于验证通不过。至少我碰到了这个问题
    Enter passphrase (empty for no passphrase):
    Enter same passphrase again:
    Your identification has been saved in /root/.ssh/id_rsa.
    Your public key has been saved in /root/.ssh/id_rsa.pub.
    The key fingerprint is:
    SHA256:rp5yIWGjih6xdd9Eo775MkVgFrCAQENWoFikQ25FsWw xuyuan_77@163.com
    The key's randomart image is:
    +---[RSA 4096]----+
    |=OB*..... |
    |*++ o .+ |
    |=o E .o .o |
    |... + o.. |
    | . + + .S. |
    | = o +.o. |
    |.+ . +o. |
    |o . . .=o |
    |.. ++o+. |
    +----[SHA256]-----+
    root@ubuntu:~/.ssh# xclip -sel clip /root/.ssh/id_rsa.pub
    root@ubuntu:~/.ssh# ssh -vT git@github.com
    OpenSSH_7.2p2 Ubuntu-4ubuntu2.2, OpenSSL 1.0.2g 1 Mar 2016
    debug1: Reading configuration data /etc/ssh/ssh_config
    debug1: /etc/ssh/ssh_config line 19: Applying options for *
    debug1: Connecting to github.com [192.30.255.112] port 22.
    ......
    debug1: Sending env LC_TIME = zh_CN.UTF-8
    debug1: Sending env LC_NAME = zh_CN.UTF-8
    debug1: client_input_channel_req: channel 0 rtype exit-status reply 0
    Hi xuyuan77! You've successfully authenticated, but GitHub does not provide shell access.
    debug1: channel 0: free: client-session, nchannels 1
    Transferred: sent 3880, received 2104 bytes, in 0.4 seconds
    Bytes per second: sent 9333.9, received 5061.5
    debug1: Exit status 1
    root@ubuntu:~/.ssh# ssh-add ~/.ssh/id_rsa
    Identity added: /root/.ssh/id_rsa (/root/.ssh/id_rsa)

  • 相关阅读:
    IOS-自定义返回按钮,保留系统滑动返回
    IOS-static cell 与 dynamic cell 混合使用
    IOS-快速集成检查更新
    IOS-如何优雅地拦截按钮事件(判断是否需要登录)
    IOS-更优雅地使用Static Cell
    Xcode8出现问题总结
    IOS-工程师Mac上的必备软件
    Minimum Sum of Array(map迭代器)
    C++ STL map
    Friends and Cookies(思维)
  • 原文地址:https://www.cnblogs.com/xuyuan77/p/7688046.html
Copyright © 2020-2023  润新知