我用的是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没有密码,但仍然错误。
在MAC中,进入终端
1)使用命令- cd ~进入主目录
2) cd .ssh && ssh-keygen(默认情况下,双击输入/返回键)
Generating public/private rsa key pair.
Enter file in which to save the key (/Users/username/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /Users/usernmae/.ssh/id_rsa.
3)之后,做“ls”。您将找到id_rsa。酒吧文件。
4)复制id_rsa. conf文件中的内容。Pub文件(使用cat命令读取- cat id_rsa.pub)
5)导航到BitBucket或任何支持SSH密钥的版本工具。使用“添加键选项”粘贴内容
就是这样。试着现在就做出承诺和努力。
同样的错误报告。
修正了使用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