内容来源于 Stack Overflow,并遵循CC BY-SA 3.0许可协议进行翻译与使用
我正试图把一个文件推给一个朋友的回复,但是在公钥上出错了。
git push origin testbranch Permission denied (publickey). fatal: Could not read from remote repository.
我们在哪里以及如何定义公钥/私钥?
Git Remote-v返回:
origin git@github.com:Sesamzaad/NET.git (fetch) origin git@github.com:Sesamzaad/NET.git (push)
任何帮助都是非常感谢的。
我只需要处理这个问题。但比我需要做的要多得多。
1. cat ~/.ssh/id_rsa.pub 2. copy the key, including the "ssh-rsa" but *excluding your computer name at the end* 3. Go to: https://github.com/settings/ssh 4. Add your SSH key
我也面临着同样的问题,这就是我为自己做的事情。
使用ssh而不是http。如果它的http是删除源。
git remote rm origin
添加ssh url
git remote add origin git@github.com:<username>/<repo>.git
在.ssh/文件夹中生成ssh键。它将请求路径和密码,只需按Enter并继续。
cd ~/.ssh ssh-keygen
复制钥匙。你可以用。如果没有指定不同的路径,那么这是默认路径。
cat ~/.ssh/id_rsa.pub
将此密钥添加到你的GitHub帐户。下一步做
ssh -T git@github.com
将在你的控制台中收到一条欢迎信息。
光盘进入项目文件夹。git push -u origin master
现在起作用了!