我在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正常工作?


当前回答

The first thing you may want to confirm is the internet connection. Though, internet issues mostly will say that the repo cannot be accessed. Ensure you have set up ssh both locally and on your github. See how Ensure you are using the ssh git remote. If you had cloned the https, just set the url to the ssh url, with this git command git remote set-url origin git@github.com:your-username/your-repo-name.git If you have set up ssh properly but it just stopped working, do the following: eval "$(ssh-agent -s)" ssh-add If you are still having the issue, check to ensure that you have not deleted the ssh from your github. In a case where the ssh has been deleted from github, you can add it back. Use pbcopy < ~/.ssh/id_rsa.pub to copy the ssh key and then go to your github ssh setting and add it.

我建议你总是使用ssh。对于我合作过的大多数团队来说,除非使用ssh,否则您无法访问回购(大多数是私有的)。对于初学者来说,这可能看起来很难,但后来你会发现它更容易和更安全。

其他回答

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

public -private key的详细设置。

这样就可以了!

使用您的HTTPS源而不是SSH url

例子:

git remote add origin  https://gitlab.com/user/folder.git

运行以下命令

open ~/.ssh

然后手动删除“known_hosts”文件

运行以下命令,生成新的ssh-key

ssh-keygen -t rsa -C "your@email.com"

然后是两个文件:id_rsa和id_rsa。Pub将在.ssh目录下生成,复制id_rsa.pub中的内容

登录github——>设置——> SSH和GPC密钥——>添加SSH密钥——>粘贴复制的内容在关键 运行以下命令

ssh -T git@github.com

好的,它起作用了

对我来说,它给出了相同的错误:

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

一个快速的解决方法是消除~/。ssh / config文件

mv config config_old && touch config

eval "$(ssh-agent -s)"

git clone your_repo

因为它原来是配置文件被损坏,并配置了两个id

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

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

ssh-add -l -E md5

如果你得到如下输出:

The agent has no identities.

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

ssh-add ~/.ssh/git_rsa

错误现在应该消失了!