1. 程式人生 > >git配置github連結

git配置github連結

1、百度git官網-下載最新版git

2、一路預設下一步安裝

3、開啟 git bash here 命令列

4、註冊github賬號(用自己的郵箱就可以,不會英文可以用谷歌翻譯)註冊成功後建立專案

5、根據專案起一個名字,建議勾選建立README 然後點選建立專案

6、配置git使用者名稱以及郵箱

  $ git config --global user.name "Your Name"

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

7、設定與github的關聯可用ssh

  檢視本地目錄C:\Users\zhangyifan下是否有.ssh檔案(有的話刪除)

  開啟git命令列鍵入

$ ssh-keygen -t rsa -C "[email protected]"  輸入你的郵箱

Creates a new ssh key using the provided email # Generating public/private rsa key pair.

Enter file in which to save the key (/home/you/.ssh/id_rsa):

——————一路按回車

完了之後,大概是這樣:

Your public key has been saved in /home/you/.ssh/id_rsa.pub.
The key fingerprint is: # 01:0f:f4:3b:ca:85:d6:17:a1:7d:f0:68:9d:f0:a2:db 
[email protected]

如果出現

ssh: connect to host github.com port 22: Connection timed out

在.ssh下面建立config檔案,內容如下:注意congig無後綴名!

Host github.comUser gitHostname ssh.github.comPreferredAuthentications publickeyIdentityFile ~/.ssh/id_rsaPort 443

測試連線情況: ssh -T [email protected]輸入yes

成功!