在同一PC上使用不同的SSH键和相同的存储库?
我正在尝试使用不同的SSH键从一台机器中进行提交/推动的设置。我已经看到了这个问题的变化,但是答案围绕着存储库a
和b
a和b用户都用于两个帐户,并且只有使用a@a@a@a
对于第一个仓库和b@b
的第二个。我有一个回购A,需要可以由用户A,B,C和D进行投入/推动,以及在没有太多麻烦的情况下在SSH键之间切换的方法。
我尝试过SSH -I {键文件路径},无济于事,是否有其他方法无需每次不同的用户想要提交凭据吗?
I am trying to do a setup where I can do commits/pushes from one single machine using different SSH keys. I have seen variations of this question but the answers revolve around having repositories A
and B
with a and b users for both accounts, and only ever using a@A
for the first repo and b@B
for the second. I have repo A which needs to be able to be commited/pushed to by users a, b, c, and d, and a way to switch between ssh keys without much hassle.
I have tried ssh -i {key file path} to no avail, is there any other way to do this without having to introduce credentials every time a different user wants to commit?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
提交用户名仅与
git config user.name
/user.email
值有关,并且与身份验证无关。身份验证仅在从远程存储库推入 /克隆时才很重要,远程存储库托管服务(github,gitlab,bitbucket ...)需要知道您是谁,以确保您拥有 right right < /em>推或克隆。
我经常在同一技术服务帐户上登录多个用户,并且必须在该服务器上贡献一个存储库。
我使用git包装器(我自己的:
vonc/gitw
)迫使用户宣布自己是第一个git命令。
,基于那将 git_committer_name/email
.gituser
自定义文件(以给定名称注册其电子邮件),用户
a
,b
,c
和d
始终用自己的用户名/电子邮件进行提交,即使它们都被记录为“技术 - 估计” ”。Commit username is only related to
git config user.name
/user.email
values, and has nothing to do with authentication.Authentication only matters when pushing to /cloning from a remote repository, where the remote repository hosting service (GitHub, GitLab, Bitbucket...) would require to know who you are, in order to make sure you have the right to push or clone.
I often have multiple users all logged on the same technical service account, and having to contribute a repository on that server.
I use a Git wrapper (my own:
VonC/gitw
) in order to force the user to declare who they are at the first git command.That will set
GIT_AUTHOR_NAME/EMAIL
andGIT_COMMITTER_NAME/EMAIL
, based on.gituser
custom file (which registers their email for a given name)That way, user
a
,b
,c
andd
always make commit with their own user name/email, even though they are all logged as "technical-account".