how to remote push repository to github--解決403forbidden和publickey問題

第一、非常好的github教程

第二、問題

2.1 403 Forbidden
This is the warning: The requested URL returned error: 403 Forbidden while accessing https://github.com
I find this answer:

Github seems only supports ssh way to read&write the repo, although https way also displayed 'Read&Write'.So you need to change your repo config on your PC to ssh way:

  1. edit .git/config file under your repo directory
vim .git/config

2.find url=entry under section [remote "origin"]
3.change it from url=https://[email protected]/derekerdmann/lunch_call.git tourl=ssh://[email protected]/derekerdmann/lunch_call.git. that is, change all the texts before @ symbol to ssh://git
4.Save config file and quit. now you could use git push origin master to sync your repo on GitHub
so I tried this command:
git remote rm origin
git remote add origin [email protected]:eduOSS/firstGitpra.git

一般只有第一次遠程纔會繼續出現以下錯誤,因爲publickey只需要設置一次就行了

2.2 Permission denied (publickey)
but only to find this warning:

Permission denied (publickey).
fatal: The remote end hung up unexpectedly

answer:

I had to add my public key to github. https://help.github.com/articles/generating-ssh-keys

when I walked through the toturial at the ent of step 2 I occured this:

Could not open a connection to your authentication agent.

so I find the answer:

I should to start the ssh-agent

exec ssh-agent bash

Finally! After finishing the torurial I got it:


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章