且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

无法使用 Windows 使用 ssh 密钥访问 gitlab 存储库

更新时间:2023-12-05 13:25:40

我收到一个弹出窗口,询问我输入的 gitlab 用户名和密码,但失败了.

I get a popup asking for my gitlab username and password which I enter and which fails.

检查,如评论:

  • git remote -v
  • git config credential.helper

如果第一个以 https:// 开头,并且第二个不为空,则您看到的是一个 Git 凭据帮助程序,它试图缓存您的 HTTPS 凭据.
这意味着您的 SSH 密钥无论如何都会被忽略.

If the first starts with https://, and the second is not empty, what you see is a Git credential helper trying to cache your HTTPS credentials.
That means your SSH key would be ignored anyway.

关于错误消息,请查看此线程,以及测试它:

Regarding the error message, check out this thread, and test it with:

ssh -o UpdateHostKeys=no -Tv git@gitlab.com

为了使其持久化,在~/.ssh/config中:

To make it persistent, in ~/.ssh/config:

Host gitlab.com
  UpdateHostKeys no