我正在尝试使用 SSH 身份验证克隆或推送到我们的 Gitlab 服务器上的空存储库,但每当我尝试时,我都会被要求输入 git 密码(使用 Git Bash):
myname@PC0016 MINGW64 /c/users/myname/dev
$ git clone git@git.repo.local:android/myApp.git
Cloning into 'myApp'...
git@git.repo.local's password:
我已经尝试了我的密码和管理员给我的 Git 密码,但我得到:
Please make sure you have the correct access rights
and the repository exists.
为什么我在 Gitlab 中将 SSH key 添加到项目文件时需要提供此密码?我错过了什么?谢谢!
最佳答案
创建一个 ssh_config`,您将在其中将客户端指向您的身份文件:
Host git.repo.local
IdentityFile C:\Users\myname\.ssh\id_rsa
也将此文件存储在
/z/.ssh/config
供您的客户阅读。
关于Git 要求输入 git@git.repo.local 密码,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39506371/