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@example.com"

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

 

  查看本地目錄C:\Users\zhangyifan下是否有.ssh文件(有的話刪除)

  打開git命令行鍵入

  $ ssh-keygen -t rsa -C "your_email@youremail.com"  輸入你的郵箱

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 your_email@youremail.com

 

如果出現

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

在.ssh下面建立config文件,內容如下:注意congig無后綴名!

Host github.com
User git
Hostname ssh.github.com
PreferredAuthentications publickey
IdentityFile ~/.ssh/id_rsa
Port 443

 

測試連接情況: ssh -T git@github.com輸入yes

成功!

 

 

 

 

 

 

 



 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM