sourceTree工具git和gitlab协同使用

随着年龄的增加,我发现自己记性越来越差,有些东西几个月就忘记了,再想做的时候一脸懵逼。但是有句话说的不是挺好么:好记性不如烂笔头,那我就抽点时间整理一下,以便自己回头看,同时为了其他同行们做个参考。

       以下就是sourceTree协同git、gitlab的使用:

一、下载git并安装

        二、下载sourceTree并安装

        三、主要讲解配置公钥ssh key

          1、右键选择gitbash,打开终端。

  2、设置git的username和email

$ git config --global user.name "zhangsan"

$ git config --global user.email "[email protected]"

3、生成SSH秘钥过程

(1)查看是否已经存在ssh秘钥:cd ~/.ssh

(2)生成秘钥

$ ssh-keygen -t rsa -C “zhangsan@gmail.com”

按3个回车,密码为空。

Your identification has been saved in /home/tekkub/.ssh/id_rsa.
Your public key has been saved in /home/tekkub/.ssh/id_rsa.pub.
The key fingerprint is:
………………


最后得到了两个文件:id_rsa和id_rsa.pub

4.测试:ssh [email protected]

The authenticity of host ‘github.com (207.97.227.239)’ can’t be established.
RSA key fingerprint is 16:27:ac:a5:76:28:2d:36:63:1b:56:4d:eb:df:a6:48.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added ‘github.com,207.97.227.239′ (RSA) to the list of known hosts.
ERROR: Hi tekkub! You’ve successfully authenticated, but GitHub does not provide shell access
Connection to github.com closed.


  四、打开gitlab网站,添加SSH key

       sourceTree工具git和gitlab协同使用_第1张图片

五、打开SourceTree

1、工具-选项

sourceTree工具git和gitlab协同使用_第2张图片


以上设置完毕,就可以了。

你可能感兴趣的:(git,github)