配置git鏈結到github遇到的問題

2021-10-06 11:43:27 字數 1765 閱讀 1999

一、對git的user以及email進行設定

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

$ git config --global user.email "your email"

二、執行,**利用自己的郵箱在本地生成金鑰

ssh-keygen -t rsa -c "***@gmail.com"
三、將生成的.pub檔案中的內容填入github的settings->ssh and gpg keys->new ssh key,標題任意

四、在本地執行,以下命令檢視本地ssh配置情況

ssh-add -l
出現錯誤資訊:the agent has no identities.

the agent has no identities.
解決方法:鍵入命令

ssh-add ~/.ssh/id_rsa (此路徑應為包含在github上填的ssh金鑰內容的路徑,

在生成金鑰時沒有修改金鑰生成的路徑,則不需要修改此命令)

出現以下資訊,表示配置正確

$ ssh-add -l

3072 sha256:lpqloqefhmzbkuup8mv2ojjky6cs5tf2nabpvqersze 86155@desktop-ir9thtc (rsa)

五、ssh配置成功後驗證是否能夠正確連線github

報錯:[email protected]: permission denied (publickey).

$ ssh -t [email protected]

[email protected]: permission denied (publickey).

原因:在生成金鑰時我修改了路徑,在ssh-add時指定的是c盤user下的金鑰,導致我在github上填的ssh金鑰與本地不一致

解決方法:重新執行ssh-add命令,指定為往github上填的那個金鑰

出現以下資訊表示成功:

$ ssh -t [email protected]

hi wdramatically! you've successfully authenticated, but github does not provide shell access.

六、同步專案到github上

$ git remote add origin [email protected]:your_project.git  

$ git push -u origin master

git add . ->將修改新增至本地快取

git commit -m 'msg' ->將本地快取儲存到本地倉庫中

git push ->將本地倉庫推送至伺服器

git pull ->將伺服器的**更新到本地倉庫中

七、配置完後邊再用的時候報錯:could not open a connection to your authentication agent.

ssh-agent bash

Git鏈結到自己的Github

好長時間沒上來弄東西了,今天回來先開始弄下git,之後再繼續寫uboot與kernel的編譯,在版本控制下更加巨集觀地觀察每次的變化。1 在ubuntu中安裝git sudo apt get install git git core2 配置本機的git git config global user....

鏈結到GitHub特定行號

在看國外的一些部落格的時候,發現他們對github的應用很好,能夠用一些高階的技巧,分享代 要選擇單行 請單擊行號以高亮顯示該行。具體寫法參考鏈結,高亮之後的鏈結 建立指向 段的永久鏈結 github docs 少有人知的 github 使用技巧 segmentfault 思否 鏈結到github特...

git生成ssh並連線到github

1.生成ssh key ssh keygen t rsa b 4096 c your email example.com 執行完畢會生成兩個秘鑰檔案id rsa和id rsa.pub,分別為私鑰和公鑰 2.將私鑰加入ssh agent 啟動ssh agent eval ssh agent s 加入私...