Phil for Humanity Phil for Humanity
A Guide for the Survival of Humankind and Helping the World, Society, and Yourself.



Git Configuration: Reading and Setting



If you ever need to list all the local and remote Git configurations, you can run this command.

git config -l

You can also just display the value of a specific Git variable. For example, to find the URL of the Git repository that you are currently in, you can run this command.

$ git config --get remote.origin.url
http://github.com/directory/repository_name.git

If you need to change any Git configuration value, then here is an example to update the Git repository’s URL variable.

git config remote.origin.url git@github.com:/new_directory/new_repository_name.git

Finally, if you want to add a new remote, you can use this command.

git remote add origin ssh://USERNAME@SERVER:PORT/directory/repository_name.git

That's it. You are now a Git configuration expert.

by Phil for Humanity
on 20121026

Related Articles
 » Git Repository Permissions
 » How to Configure Global Git Hooks
 » Git Merge