I want to version control various directories, mostly selected directories in the /etc directory of various machines with GIT.
On the machine and account from which ssh to other machines, I have add these to my ~/.bashrc file[they can be put into putty somewhere as well]:
export GIT_AUTHOR_NAME="Raymond Burkholder" export GIT_AUTHOR_EMAIL=raymond@burkholder.net export GIT_COMMITTER_NAME="$GIT_AUTHOR_NAME" export GIT_COMMITTER_EMAIL="$GIT_AUTHOR_EMAIL"
To make the variables immediately available:
source ~/.bashrc
The purpose for these variables to make it easier to make my information automatically available when/where ever git commits are made, regardless of which machine or account into which I may be logged.
The variables will cross over an ssh session (after making the changes below), but won't cross over into a 'sudo su' session. They may work in a 'sudo something something' session (something to be tested).
The ssh client needs to be adjusted to pass the environment variables, with a change to ~/.ssh/config:
SendEnv LANG LC_* GIT_*
On the destination server, modify /etc/ssh/sshd_config:
Add this to /etc/sudoers:AcceptEnv LANG LC_* GIT_*
Defaults env_keep += "GIT_*"
And restart sshd on that destination machine:
systemctl restart sshd
I can then ssh back into the server, and I can see the variables (the same can be run on my local machine to confirm they were set and ready for forwarding via ssh):
$ env | grep GIT GIT_AUTHOR_NAME=Raymond Burkholder GIT_COMMITTER_NAME=Raymond Burkholder GIT_AUTHOR_EMAIL=raymond@burkholder.net GIT_COMMITTER_EMAIL=raymond@burkholder.net