Last active
November 16, 2021 08:39
-
-
Save xphere/835563e8ba5352ad31465aba19907bb7 to your computer and use it in GitHub Desktop.
How to call git with default configuration?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# git gets configuration from three main places: current repository, current user, system-wide | |
# Those can be skipped by changing the following environment variables | |
# PREFIX= HOME= GIT_CONFIG_NOSYSTEM= | |
# NOTE: Current repository can't be overriden | |
# But git requires at least the author and committer name/email | |
# Those must be setup with the following environment variables | |
# GIT_AUTHOR_NAME= GIT_AUTHOR_EMAIL= GIT_COMMITTER_NAME= GIT_COMMITTER_EMAIL= | |
# Thus the call will be something like this | |
EMAIL="[email protected]" | |
NAME="Name Surname" | |
export GIT_AUTHOR_NAME="$NAME" | |
export GIT_AUTHOR_EMAIL="$EMAIL" | |
export GIT_COMMITTER_NAME="$NAME" | |
export GIT_COMMITTER_EMAIL="$EMAIL" | |
export GIT_CONFIG_NOSYSTEM=1 | |
PREFIX=/tmp HOME=/tmp git "$@" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment