Skip to content

Instantly share code, notes, and snippets.

@PieterScheffers
Created March 20, 2018 15:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save PieterScheffers/f61a675152b4bf71d0abc6fd499cbda2 to your computer and use it in GitHub Desktop.
Save PieterScheffers/f61a675152b4bf71d0abc6fd499cbda2 to your computer and use it in GitHub Desktop.
Pass Git variables via LC_* variables in SSH
#!/usr/bin/env bash
# Set GIT variables via LC variables
# LC gets default passed via ssh
# Put this in .bash_profile
if [[ -z "${GIT_AUTHOR_NAME}" ]]; then
if [[ -n "${LC_GIT_AUTHOR_NAME}" ]]; then
export GIT_AUTHOR_NAME="${LC_GIT_AUTHOR_NAME}"
fi
fi
if [[ -z "${GIT_AUTHOR_EMAIL}" ]]; then
if [[ -n "${LC_GIT_AUTHOR_EMAIL}" ]]; then
export GIT_AUTHOR_EMAIL="${LC_GIT_AUTHOR_EMAIL}"
fi
fi
if [[ -z "${GIT_COMMITTER_NAME}" ]]; then
if [[ -n "${LC_GIT_COMMITTER_NAME}" ]]; then
export GIT_COMMITTER_NAME="${LC_GIT_COMMITTER_NAME}"
fi
fi
if [[ -z "${GIT_COMMITTER_EMAIL}" ]]; then
if [[ -z "${LC_GIT_COMMITTER_EMAIL}" ]]; then
export GIT_COMMITTER_EMAIL="${LC_GIT_COMMITTER_EMAIL}"
fi
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment