我用的是Mac雪豹,刚刚安装了git。
我只是试了
git clone git@thechaw.com:cakebook.git
但这给了我这个错误:
Initialized empty Git repository in `/Users/username/Documents/cakebook/.git/`
Permission denied (publickey).
fatal: The remote end hung up unexpectedly
我错过了什么?
我也试过做ssh-keygen没有密码,但仍然错误。
同样的错误报告。
修正了使用HTTPS而不是SSH协议的问题。因为我不想为测试PC设置“SSH密钥”。
克隆时将URL更改为HTTPS:
git clone https://github.com/USERNAME/REPOSITORY.git
我的问题有点不同:当添加一个现有的本地回购到远程时,我有URL设置为SSH,通过使用:
git remote add origin ssh://github.com/USERNAME/REPOSITORY.git
要解决这个问题,请将URL重置为HTTPS:
git remote set-url origin https://github.com/USERNAME/REPOSITORY.git
顺便说一句,你可以使用命令检查你的URL:
git remote -v
origin https://github.com/USERNAME/REPOSITORY.git (fetch)
origin https://github.com/USERNAME/REPOSITORY.git (push)
希望这能帮助到像我这样的人。: D
我遇到了同样的问题,因为我认为SSH和HTTPS之间的区别是
https://github.com/USERNAME/REPOSITORY.git
ssh: / / github.com/USERNAME/REPOSITORY.git
因此,我从HTTPS更改为SSH,只需将https://更改为SSH:// url的末尾没有任何变化。
但事实是:
https://github.com/USERNAME/REPOSITORY.git
git@github.com:USERNAME/REPOSITORY.git
这意味着我将ssh://github.com/USERNAME/REPOSITORY.git更改为git@github.com:USERNAME/REPOSITORY.git。
愚蠢的错误,但希望能帮助某人!