1. 程式人生 > >sourceTree工具git和gitlab協同使用

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

1、工具-選項


以上設定完畢,就可以了。