Tired of having to add your author info to every commit and to retype your credentials when you work on remote (eventually shared) box?
Just take your credentials with you!
What you need:
- Configure your git author/committer info via environment variables
- Have a remote box with an sshd that is configured to accept your
GIT_*environment variables in
/etc/ssh/sshd_config( Maybe you'll have to ask your admin nicely for this one )
- Connect to the box using ssh-agent and Agent-Forwarding
Set your git info in your env
Add this to your
.bashrc (or to vour
~/.secrets if using YADR):
export GIT_AUTHOR_NAME="Jens Hausherr" export GIT_AUTHOR_EMAIL="email@example.com" export GIT_COMMITTER_NAME="$GIT_AUTHOR_NAME" export GIT_COMMITTER_EMAIL="$GIT_AUTHOR_EMAIL"
Configure the remote SSHD to accept you environment variables:
AcceptEnv LANG LC_* GIT_*
Fire up your
ssh-agent and add your key via
Connect to the remote box using Agent-Forwarding
ssh -A user@host #for Linux/Mac
If everything worked you should find the
GIT_* variables in the shell of the remote box along with the
SSH_AUTH_SOCK that forwards your auth key via the SSH connection.
Happy remote committing :)