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://MichaelDrogalis@github.com/derekerdmann/lunch_call.git   to url=ssh://git@github.com/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 git@github.com: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:



版权声明:本文为zl4546474849l原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。