zii*_*web 197 git github public-key
我已按照以下说明上传项目.
全球设置:
Download and install Git
git config --global user.name "Your Name"
git config --global user.email tirenga@gmail.com
Add your public key
Next steps:
mkdir tirengarfio
cd tirengarfio
git init
touch README
git add README
git commit -m 'first commit'
git remote add origin git@github.com:tirenga/tirenga.git
git push origin master
Run Code Online (Sandbox Code Playgroud)
但我得到这个错误:
权限被拒绝(publickey).致命:远程端意外挂断
zii*_*web 124
我不得不将我的公钥添加到github.https://help.github.com/articles/generating-ssh-keys
小智 28
是的,这是一个公钥问题. 我是Windows用户,下面的页面可以帮助我解决这个问题.
更准确地说,这个链接应该是有用的
https://help.github.com/articles/error-permission-denied-publickey
小智 28
创建RSA密钥对后,必须使用以下命令将其添加到SSH:
ssh-add ~/.ssh/id_rsa
Run Code Online (Sandbox Code Playgroud)
或者您创建rsa密钥对的任何地方.
Smu*_*ndo 24
对我来说,问题是通过sudo执行克隆.
如果你克隆到你有用户权限的目录(/ home/user/git),它将正常工作.
(说明:以超级用户身份运行命令不能使用与用户运行命令相同的公钥.因此Github拒绝连接.)
此解决方案需要设置SSH密钥:https://help.github.com/articles/generating-ssh-keys
小智 18
使用您的用户名和存储库名称键入以下命令:
git clone https://github.com/{user name}/{repo name}
Run Code Online (Sandbox Code Playgroud)
在Ubuntu中,这非常有效.
raf*_*uzo 16
经过很长一段时间的教程,我得到了一个解决方案.
我按照这个链接上的github教程 - > https://help.github.com/articles/error-permission-denied-publickey,我能够在每一步都连接.但是当我试图git push -u origin master时,我收到了这个错误:
权限被拒绝(publickey).致命:无法从远程存储库读取.
请确保您拥有正确的访问权限
多数民众赞成我如何修复它! 使用终端转到项目目录并检查它
$git remote -v
Run Code Online (Sandbox Code Playgroud)
你会得到这样的东西:
origin ssh://git@github.com/yourGithubUserName/yourRepo.git (fetch)
origin ssh://git@github.com/yourGithubUserName/yourRepo.git (push)
Run Code Online (Sandbox Code Playgroud)
如果您使用的是git@github.com之外的任何其他内容,请通过键入以下命令打开git目录中的配置文件:
vi .git/config
Run Code Online (Sandbox Code Playgroud)
并配置线路
[remote "origin"]
url = ssh://git@github.com/yourGithubUserName/yourRepo.git
fetch = +refs/heads/*:refs/remotes/origin/
Run Code Online (Sandbox Code Playgroud)
我有这个问题,但上面的解决方案都没有奏效.我可以克隆和获取但无法推送.最后,我发现问题出现url在我的.git/config,应该是:
git@github.com:<username>/<project>
Run Code Online (Sandbox Code Playgroud)
(不是ssh://github.com/<username>/<project>.git或https://github.com/<username>/<project>.git).
鉴于这里没有任何答案对我有用,我终于通过ssh -vT git@bitbucket.org跟踪了我与Bitbucket(或Github,在本案中无关紧要)的问题.
在我的情况下,失败是由于使用DSA密钥而不是RSA,显然我的SSH客户端不再允许这样做.
debug1:在PubkeyAcceptedKeyTypes中没有跳过ssh-dss键/c/Users/USER/.ssh/id_dsa
解决方案是将此添加到.ssh/config:
Host *
PubkeyAcceptedKeyTypes +ssh-dss
Run Code Online (Sandbox Code Playgroud)
这优雅地将ssh-dss密钥类型附加到所有现有的公共密钥类型,在完成之后,git现在可以ssh到Bitbucket没问题.