我已经在Windows机器上安装了Github客户端工具。如果我尝试从git shell使用git,那么效果很好。但是,如果我尝试从Windows命令行使用它,它将失败:
c:\git\test>git clone git@github.com:myusername/myrepo.git
Cloning into 'myrepo'...
Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
Run Code Online (Sandbox Code Playgroud)
我只使用git shell,但是我需要设置命令行以使用Bower。要使git工作还需要设置什么?
我使用的是未在其上设置SSH的Windows机器,因此已设置的唯一SSH密钥是由github安装程序设置的。在我的.ssh目录中,我有一个github_rsa和github_rsa.pub文件,但没有默认的ssh密钥id_rsa和id_rsa.pub。当与github.com对话时,Github客户端(包括shell和GUI)将使用github_rsa(.pub)组合键,但是在标准Windows命令行中运行的git需要id_rsa(.pub)组合。
要解决此问题,我只复制了github_rsa私钥,并为其指定了默认名称“ id_rsa”。同样,我将github_rsa.pub密钥复制到“ id_rsa.pub”。这样做后,git.exe也可以从Windows命令行运行。
| 归档时间: |
|
| 查看次数: |
1151 次 |
| 最近记录: |