简体   繁体   English

在 Windows 上使用 SSH 密码“去获取”私人仓库

[英]'go get' private repo with SSH password on Windows

I am trying to go get a private GitLab repo on Windows.我正在尝试go get私有 GitLab 回购。

I've added this to my .gitconfig :我已将此添加到我的.gitconfig

[url "ssh://git@gitlab.com"]
    insteadOf = https://gitlab.com

I've added the ssh key password using ssh-add C:\Users\<username>\ssh\id_rsa我使用ssh-add C:\Users\<username>\ssh\id_rsa添加了 ssh 密钥密码

However I'm still getting git@gitlab.com: Permission denied (publickey).但是我仍然收到git@gitlab.com: Permission denied (publickey). . .

This SSH key definitely works and is already registered in GitLab.这个 SSH 密钥绝对有效,并且已经在 GitLab 中注册。 It's the only SSH key I've ever configured for GitLab, and the only SSH key that exists on my PC.这是我为 GitLab 配置的唯一 SSH 密钥,也是我 PC 上唯一存在的 SSH 密钥。 I've been using this key for a long time for all my private repos just fine, but go get somehow can't find it.很长一段时间以来,我一直在为我的所有私人仓库使用此密钥,但go get不知何故找不到它。

This SSH key definitely works这个 SSH 密钥绝对有效

You can make sure of that with:您可以通过以下方式确保这一点:

ssh -Tv git@gitlab.com

If you see a Welcome message with your GitLab account name in it, the key does work indeed.如果您看到一条欢迎消息,其中包含您的 GitLab 帐户名,则该密钥确实有效。
Check then if that account is the owner (or a collaborator) of the provate repository you want to access.然后检查该帐户是否是您要访问的 provate 存储库的所有者(或合作者)。

And of course, double check the <projectName>/<repositoryName> used in your URL, for any typos or case (lowercase/upercase) error.当然,请仔细检查 URL 中使用的<projectName>/<repositoryName>是否有任何拼写错误或大小写(小写/大写)错误。

Adding export GOPRIVATE=* might help too, for testing.添加export GOPRIVATE=*也可能有助于测试。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM