Gitlab权限被拒绝(公钥

时间:2020-01-24 05:12:32

标签: ssh gitlab permission-denied

Soo我已经看到许多有关此错误的票证,但没有一个完全匹配我的。我试图将更改推送到最近创建的仓库中,并且不断收到此错误:

Permission denied (publickey,gssapi-keyex,gssapi-with-mic).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

我可以轻松地将更改推送到已经使用了几个月的其他存储库。我添加了一个ssh并允许在gitlab中执行此操作。所以我不确定什么似乎是问题所在。我需要向gitlab acc添加新的ssh密钥吗?

1 个答案:

答案 0 :(得分:2)

首先将问题存储库的远程URL与推送成功的其他存储库所使用的远程URL进行比较。

cd /path/to/repo
git remote -v

如果其他URL是HTTPS(https://gitlab.com/<user>/<repo>)而不是SSH(git@gitlab.com:<user>/<repo>),则它们仍然不会使用SSH密钥。

还要检查ssh -Tv git@gitlab.com是否成功。