Skip to content

Instantly share code, notes, and snippets.

@entrptaher
Created May 7, 2023 04:51
Show Gist options
  • Save entrptaher/5a0fe1ea0597bf04716d9566ba632cfe to your computer and use it in GitHub Desktop.
Save entrptaher/5a0fe1ea0597bf04716d9566ba632cfe to your computer and use it in GitHub Desktop.

How to commit as your username when working remotely on a server

WAY 1: RemoteCommand

CLIENT: set the RemoteCommand in ~/.ssh/config

Host AwesomeServer
  HostName host.example.com
  User ubuntu
  ForwardAgent yes
  RemoteCommand GIT_AUTHOR_NAME="The Boss" GIT_AUTHOR_EMAIL=boss@example.com $SHELL
  RequestTTY yes

WAY 2: SetEnv

SERVER: edit /etc/ssh/sshd_config to accept GIT_ variables and restart sshd

AcceptEnv LANG LC_* GIT_*

CLIENT: set the SetEnv in ~/.ssh/config

Host AwesomeServer
  HostName host.example.com
  User ubuntu
  ForwardAgent yes
  SetEnv GIT_AUTHOR_NAME="The Boss" GIT_AUTHOR_EMAIL=boss@example.com
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment