git - 无法使用 git+ssh 克隆
问题描述
我需要通过 git+ssh (git+ssh://git.host.repository.com) 克隆一个存储库。它失败了,因为它使用我的操作系统用户名而不是我的组织用户名。
Cloning into 'project.name'...
francesco@git.host.repository.com's password:
“francesco”是我的操作系统帐户名,显然无法登录。在 ~/.ssh/config 我添加了:
IdentityFile ~/.ssh/id_rsa.pub
但它没有用。我还尝试更新密钥(其中包含我的公司帐户):
touch ~/.ssh/id_rsa.pub
它仍然尝试使用操作系统用户名登录,而不是公钥中包含的用户名。有什么帮助吗?
解决方案
您应该编辑类似于下面的 ssh 配置文件。User
可以强制用户使用 for ssh
。
Host git.host.repository.com
HostName git.host.repository.com
User git
IdentityFile ~/.ssh/github/id_rsa
推荐阅读
- android - 在仪器化单元测试中模拟方法
- python - 如何在python中将环境变量添加为time.sleep
- php - PHP中用于编辑页面的递归类别树
- javascript - 如何在 ReactJs 样式中有条件地调用不同的类名
- sql - 在 Hana 中使用 with 子句创建表
- python - TypeError:只能将str(不是“numpy.int64”)连接到str
- javascript - 在数组中查找字符串
- c# - 在 ASP.NET Core 2.2 中使用 InProcess 托管模型时,Serilog 不会将日志写入文件
- symfony - 实体值不持久(Doctrine - Symfony 4.1)
- python - 从 temp_pb2.py 文件生成 temp.proto 文件