• ubuntu下安装及配置git的方法


    安装Git

    一个全新的ubunt系统,需要安装Git(系统是不具有该工具的),方法如下:
    在terminel中输入如下命令:

    sudo apt-get install git git-core git-gui git-doc git-svn git-cvs gitweb gitk git-email git-daemon-run git-el git-arch
    

    接下来需要检查SSH

    因为GitHub会用到SSH,因此需要在shell里检查是否可以连接到GitHub

    ssh -T git@github.com
    

    如果看到:

    Warning: Permanently added ‘github.com,204.232.175.90’ (RSA) to the list of known hosts. 
    Permission denied (publickey).
    

    则说明可以连接。
    这里假设你已经就有了GitHub用户(如果没有,需要去注册GitHub)

    安装SSH keys(一定要在~/.ssh目录下操作)

    在安装GitHub之前,需要先安装SSH keys

    第一步:检查是否已井具有ssh keys,如果已经具有,则进行第二步,否则,进行第三步

    cd ~/.ssh
    ls
    

    第二步:执行如下命令(不具有ssh keys时):

    qunzhupu$ ssh-keygen -t rsa -C "984471751@qq.com"
    

    得到结果如下:

    qunzhudeMacBook-Air:~ qunzhupu$ ssh-keygen -t rsa -C "984471751@qq.com"
    Generating public/private rsa key pair.
    Enter file in which to save the key (/Users/qunzhupu/.ssh/id_rsa): 
    Enter passphrase (empty for no passphrase): 
    Enter same passphrase again: 
    Your identification has been saved in /Users/qunzhupu/.ssh/id_rsa.
    Your public key has been saved in /Users/qunzhupu/.ssh/id_rsa.pub.
    The key fingerprint is:
    SHA256:Rrae8DPfiAIy/KbxJrwBILPH4kkRkklMMxJAeP6LrqA 984471751@qq.com
    The key's randomart image is:
    +---[RSA 2048]----+
    |%@               |
    |*.=              |
    |++      o        |
    |o+o    o .       |
    |+oo.  . S        |
    |o+= o  = .       |
    |.+o= o  *        |
    |o ++= .  = o     |
    |Eo+*.  .. o .    |
    +----[SHA256]-----+
    

    第三步:将刚刚创建的ssh keys添加到github中

    1. 利用gedit/cat命令,查看id_rsa.pub的内容
    2. 在GitHub中,依次点击Settings -> SSH Keys -> Add SSH Key,将id_rsa.pub文件中的字符串复制进去,注意字符串中没有换行和空格。
      第五步:再次检查SSH连接情况(在~/.ssh目录下):

    输入如下命令:

    ssh -T git@github.com
    

    如果看到如下所示,则表示添加成功:

    Hi 你的用户名! You’ve successfully authenticated, but GitHub does not provide shell access.
    

    此时,发现github上已有了SSH keys

    大道理谁都懂,鸡汤也听过,可我们为什么还是过不好这一生。
  • 相关阅读:
    学习笔记:字符串-Hash
    模板:高精度
    关于我自己
    学习笔记:数学-GCD与LCM-素数筛法
    学习笔记:数学-GCD与LCM-唯一分解定理(质因数分解)
    学习笔记:数学-GCD与LCM-整除的基础概念
    题解 洛谷P1990 覆盖墙壁
    学习笔记:平衡树-splay
    npm发布myself的插件
    javascript API文档
  • 原文地址:https://www.cnblogs.com/puqunzhu/p/9774424.html
Copyright © 2020-2023  润新知