繁体   English   中英

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

[英]Git asking for git@git.repo.local password

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

当我将 SSH 密钥添加到 Gitlab 中的项目文件时,为什么需要提供此密码? 我错过了什么? 谢谢!

创建一个 ssh_config`,您将在其中将您的客户端指向您的身份文件:

Host git.repo.local
  IdentityFile C:\Users\myname\.ssh\id_rsa

还要将此文件存储在/z/.ssh/config以供客户端读取。

您需要一个 ssh 密钥才能跳过身份验证阶段。 通常我执行的操作是:

  1. 如果您还没有 ssh 密钥,请生成一个:指令
  2. 将密钥添加到 gitlab: page
  3. 通过 ssh 克隆存储库:项目主页中的克隆或下载按钮,
  4. 设置提交消息的用户名或电子邮件地址: 说明
  5. 玩得开心!!!

如果您正确设置了密钥,一切都会好起来的。

暂无
暂无

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

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