我在Windows上使用TortoiseGit。当我试图从标准Windows资源管理器的上下文菜单克隆时,我得到这个错误:

请确保您拥有正确的访问权限并且存储库存在

更准确地说,终端的快照如下:

——progress -v "git@arobotdev:\git\AlfaRobot. exe。git”“C: \ \ AlfaRobot” 克隆到“C:\Work\AlfaRobot”… 权限被拒绝,请重试。 权限被拒绝,请重试。 权限被拒绝(公钥,密码)。 无法从远程存储库读取。 请确保您拥有正确的访问权限 并且存储库存在。 Git没有干净地退出(退出代码128)(21450 ms @ 19.09.2014 10:36:58)

我应该怎么做才能使git正常工作?


当前回答

您正在尝试通过ssh: git@arobotdev..克隆存储库。,并且您的SSH密钥在服务器上没有正确设置。原因有很多:

您的公钥可能没有保存在用户git的authorized_keys文件中 如果1不为真,则“您的私钥不保存在您的HOMEDIR的。ssh/文件夹中”。 权限设置不正确

如果以上三点都不属实,那么我唯一的结论就是: git@arobotdev: AlfaRobot.git 假设AlfaRobot。git在git用户的HOMEDIR目录下,而不是在git用户的HOMEDIR目录下的名为git的文件夹中。

其他回答

奇怪的是,我只收到这个错误在1我的许多回购。

我的问题是在安装了新的GitHub Desktop for Windows之后,以前的旧GitHub for Win将键保存在~/中。Ssh /github_rsa和~/. Ssh /github_rsa。新的GitHub for Win期望它在~/。Ssh /id_rsa,所以解决方案只是重命名现有的私钥和公钥:

~/.ssh/github_rsa -> ~/.ssh/id_rsa
~/.ssh/github_rsa.pub -> ~/.ssh/id_rsa.pub

之后,让我再次访问回购没有问题。

如果它之前工作,突然停止工作:

此问题可能是因为有时ssh-agent在重新启动时不是持久的。你应该检查ssh-agent是否添加了你的密钥:

ssh-add -l -E md5

如果你得到如下输出:

The agent has no identities.

这意味着ssh-agent丢失了您的密钥。在这种情况下,您只需要再次添加标识键。喜欢的东西:

ssh-add ~/.ssh/git_rsa

错误现在应该消失了!

rsa。Pub(即公钥生成),需要在github上添加>>设置>>ssh密钥页面。请检查,您没有在存储库设置>>部署密钥中添加此公钥。如果是,从这里删除条目,并添加到第一个提到的位置。

public -private key的详细设置。

这样就可以了!

您可以按照以下步骤-

Check for existing keys- a. ls -al ~/.ssh Create key if does not exist- Paste the text below, substituting in your GitHub email address. a. ssh-keygen -t ed25519 -C "your_email@example.com" b. When you're prompted to "Enter a file in which to save the key," press Enter. This accepts the default file location. c. At the prompt, type a secure passphrase. Adding your SSH key to the ssh-agent- Fire up the SSH agent and add the key eval ssh-agent -s ssh-add ~/.ssh/id_ed25519 Adding key to Git account- Pull up the key and add to Github account cat ~/.ssh/id_ed25519.pub Navigate to Git account and add SSH key

错误配置的~/。Ssh /config文件可以触发此错误。

GitHub的test命令基本上为我打印出了解决方案:

ssh -T git@github.com

/用户/ myUser /。第13行:错误的配置选项:something-that-did-not-make-sense