简体   繁体   English

远程ssh会话期间的本地git配置

[英]local git config during remote ssh session

To be clear, what I'm not asking is how to bring my ssh keys with me along an ssh session. 明确地说,我不是要问的是如何在ssh会话中随身携带ssh密钥。 I'm aware that ssh -A will do what I want. 我知道ssh -A会做我想要的。

However, what I notice is that all global config on the remote machine are being applied to my git commands, so even though my ssh key is being used to git push/pull. 但是,我注意到的是,远程计算机上的所有全局配置都已应用于我的git命令,因此即使我的ssh密钥已用于git push / pull。

The problem is that when I do commit, the Author string is not me. 问题是当我提交时,Author字符串不是我。

So the questions is, is there any way to bring my global git config from my client machine across an ssh session to use on the remote machine? 因此,问题是, 是否有任何方法可以将我的全局git config从客户端计算机跨ssh会话带到远程计算机上使用?

The problem is that when I do commit, the Author string is not me. 问题是当我提交时,Author字符串不是我。

The ssh session is done as the remote user you are specifyong in your ssh <remoteUser>@remotemachine> ssh会话以您在ssh <remoteUser>@remotemachine>中指定的远程用户身份完成

Once you are in your remote ssh session, do a ( with Git 2.8+ ): 进入远程ssh会话后,执行一个操作( 使用Git 2.8+ ):

git config -l --show-origin

You will see all configurations, including from where the user.name is coming from. 您将看到所有配置,包括user.name的来源。

If you want at least to use the right user.name/email, you would need to specify them in your git commit command: 如果至少要使用正确的user.name/email,则需要在git commit命令中指定它们:

git commit -c user.name=xxx -c user.email=yyy commit -m "my commit"

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

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