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:


  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值