Sunday, May 25, 2014

[Quick Note] Modifying Git Configurations in Ubuntu and Windows

OS : Ubuntu 13.10 or Windows 7

This is a brief post on how to change default configuration entries for Git.

There might be requirements that you need to change the default username where the commits get written to github, specially if you created a new github account, changed email etc.

Git uses global configuration file called .gitconfig in order to store the global credentials. To change the default user you can simply edit this file.

isha@thinkpad:~$ vim .gitconfig

For Windows this file can be found in file: git/etc/.config location.
I have set the following three properties here.

 1. username: github username of author.
 2. user email: github email address of user.
 3. credential helper: turn on the credential helper so that Git will save your password in memory for some time. By default Git will cache your password for 15 minutes. You can change this by changing --timeout property in the command.

        name = ishadil
        email =
        helper = cache --timeout=3600  // i have changed timeout for 1 hour

Other option is doing this using the command prompt as below.

git config --global "ishadil"

git config --global ""

git config --global credential.helper 'cache --timeout=3600'

After that use git config --global --list command to verify whether the properties are reset correctly.

git config --global --list

In a similar manner there are lot more configuration entries that can be set into this file. For e.g. let's set a proxy url in to git .config file.

    proxy =

No comments:

Post a Comment