Skip to content

Instantly share code, notes, and snippets.

@anandjagadeesh
Last active September 13, 2020 18:49
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 anandjagadeesh/dede7154dd04de0d1832ee15698c5c6b to your computer and use it in GitHub Desktop.
Save anandjagadeesh/dede7154dd04de0d1832ee15698c5c6b to your computer and use it in GitHub Desktop.
git config

How to configure name, email, etc in Git!

<...> means variable ---> Fill it with appropriate value and [...] means optional

To configure name for a repo: git config user.name "my name"

To configure name globally: git config --global user.name "my name"

To configure email for a repo: git config user.mail "myname@domain.com"

To configure email globally: git config --global user.mail "myname@domain.com"

To remove a name: git config --unset-all user.name

To remove a name globally: git config --global --unset-all user.name

To remove a email: git config --unset-all user.mail

To remove a email globally: git config --global --unset-all user.mail

To edit the config file: git config --global --edit

Storing username and password so that you don't have to enter it everytime:

Way #1: Clone with username and password | git clone https://<username>:<password>@github.com/path/to/repo.git

Way #2: Set remote to use the password after clone: git remote set-url origin https://<username>:<password>@github.com/path/to/repo.git

Way #3: Enable credential store: git config [--global] credential.helper store

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment