Git 要求输入 git@git.repo.local 密码

标签 git bash ssh passwords gitlab

我正在尝试使用 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/

相关文章:

git - 查看 GitHub 为 Windows 客户端执行的命令

~/.zshrc 中的 python 别名覆盖虚拟环境源

postgresql - 无法在 Ubuntu 上建立 Postgres pgAdmin SSH 隧道

linux - 在每次 vagrant up 命令后,如何防止 RSA key 的指纹发生变化?

python - 远程运行 python 脚本的更好方法

git - 使用 git diff 为部署创建文件列表的问题

linux - 多操作系统环境中的 Git 行尾

git - 如何别名 git checkout && git stash apply

Linux 检查 shell 命令 (bash)

c++ - 寻求将构建工具链从 bash/grep/sed/awk/(auto)make/configure 重新实现为更理智的东西(例如 boost.build 等)