• 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)

  • 相关阅读:
    Use MusicBrainz in iOS(三)查询专辑的完整信息
    内存寻址一(分段)
    POJ 1018 Communication System (动态规划)
    利用Eclipse中的Maven构建Web项目(二)
    cocos2d-x2.2.3学习
    (排序算法整理)NEFU 30/32
    POJ 1066 昂贵的聘礼
    2014年腾讯暑假实习软件开发笔试题汇总
    Android学习之——自己搭建Http框架(1)
    C 语言之预处理 ---------文件包括
  • 原文地址:https://www.cnblogs.com/xuyuan77/p/7688046.html
Copyright © 2020-2023  润新知