Set your user name, email and GitHub token

This guide covers basic git settings you should set before making any commits.

Please note that config changes will only affect future commits. Existing commits will retain the info they were committed with. Also, the environment variables GIT_COMMITTER_NAME, GIT_COMMITTER_EMAIL, GIT_AUTHOR_NAME and GIT_AUTHOR_EMAIL will override git-config settings if they are defined.

  1. Set your username and email.

    Git tracks who makes each commit by checking the user’s name and email. In addition, we use this info to associate your commits with your GitHub account. To set these, enter the code below, replacing the name and email with your own. The name should be your actual name, not your GitHub username.

    	$ git config --global user.name "Firstname Lastname"Sets the name of the user for all git instances on the system
    	$ git config --global user.email "your_email@youremail.com"Sets the email of the user for all git instances on the system
    

    More about user info

    The steps listed above show you how to set your user info globally. This means that no matter which repo you work in on your computer, you’ll be making commits as that user. If you find yourself needing to make commits with different user info for a specific repo (perhaps for work vs. personal projects), you will have to change the info in that repo itself.

    			$ cd my_other_repoChanges the working directory to the repo you need to switch info for
    			$ git config user.name "Different Name"Sets the user's name for this specific repo
    			$ git config user.email "differentemail@email.com"Sets the user's email for this specific repo
    		

    Now your commits will be “blamed” on (associated with) new user name and email whenever working in the specified repo.

  2. Set your GitHub token.

    Some tools connect to GitHub without SSH. To use these tools properly you need to find and configure your API Token.

    On the GitHub site Click “Account Settings” > Click “Account Admin.”

    Copy your API token

    At the command line run the following code, using your GitHub username and token in place of the ones shown.

    	$ git config --global github.user usernameSets the GitHub username for all git instances on the system
    	$ git config --global github.token 0123456789yourf0123456789tokenSets the GitHub token for all git instances on the system
    

    *Note* If you ever change your GitHub password, a new token will be created and will need to be updated.