【问题标题】:Not able to push to Github, getting "permission denied (publickey)" [duplicate]无法推送到 Github,得到“权限被拒绝(公钥)” [重复]
【发布时间】:2013-03-09 07:36:16
【问题描述】:
Administrator@SANZVAIO /e/projects/pySan (master)
$ git remote add pySan git@github.com:sanfx/.git

Administrator@SANZVAIO /e/projects/pySan (master)
$ git push -u origin master
The authenticity of host 'github.com (207.97.227.239)' can't be established.
RSA key fingerprint is 16:27:ac:a5:76:28:2d:36:63:1b:56:4d:eb:df:a6:48.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'github.com,207.97.227.239' (RSA) to the list of know
n hosts.
Permission denied (publickey).
fatal: The remote end hung up unexpectedly

还有其他方式可以推送到 github 吗?我在 Windows 7 上使用 Git Bash。

【问题讨论】:

  • 你上传你的ssh key to github了吗?
  • 是的,srikanth,这解决了问题,但现在我得到了这个$ git push git@github.com:sanfx/pySan.git Enter passphrase for key '/e/Users/Administrator/.ssh/id_rsa': To git@github.com:sanfx/pySan.git ! [rejected] master -> master (non-fast-forward) error: failed to push some refs to 'git@github.com:sanfx/pySan.git' hint: Updates were rejected because the tip of your current branch is behind hint: its remote counterpart. Merge the remote changes (e.g. 'git pull') hint: See the 'Note about fast-forwards' in 'git push --help' for details.
  • 只是:你的本地分支在远程分支的“后面”,所以你不能推送,直到你拉(更新)你的本地分支。 Git 是一个非常强大的工具,它实际上可以增强您的开发。请阅读这篇关于 Git 的优秀指南:git-scm.com/book/en

标签: git ssh public-key github-for-windows


【解决方案1】:
  1. 你的 repo URL 错误
  2. 您可能还遇到了 SSH 问题。

您应该首先通过the webinterfaceGitHub API 在 GitHub 上创建一个空存储库

假设您刚刚创建了myrepo,要使用的 URL 语法是:

git remote add pySan git@github.com:sanfx/myrepo.git

如果您仍然有 SSH 错误,请检查您的公钥/私钥对,或使用 https 开始:

git remote set-url pySan https://github.com/sanfx/myrepo.git

【讨论】:

  • 无论如何我想通了,首先我必须为这个 Windows 登录正确设置 SSH 密钥,然后我必须使用这个命令 git push -f origin <branch name> ,我正走在道路上变得愚蠢......
猜你喜欢
  • 2017-12-18
  • 1970-01-01
  • 2014-12-03
  • 2014-02-01
  • 2012-01-18
  • 2012-04-25
  • 1970-01-01
  • 2016-02-29
相关资源
最近更新 更多