Skip to main content
  1. Learn center
  2. Software Development
  3. Guides
  4. Git tutorial
  5. Git commands & settings
  6. Git config commands
GuidesSoftware DevelopmentBacklog
Git

Project and code management together.

Git config commands


Set username and email

$ git config --global user.name <username>
$ git config --global user.email <mailaddress>

Without the --global option, this setting will only apply to a specific repository.

Color displayed output

$ git config --global color.ui auto

Set alias for command

$ git config --global alias.<aliasname> <commandname>

Remove files from version control tracking

$ echo <filename> >> .gitignore

Add the paths of files under the .gitignore file. Git will no longer manage those files. You will have to commit the .gitignore file for this to work.

Track empty directories under version control

$ cd <dirname>
$ touch .gitkeep

Git does not track empty directories. If you would like to add that to the version control, you will need to place a file in that directory. A common practice that people normally do is to add a .gitkeep file to the empty directory.

Display settings

$ git config --global --list

Setup HTTP connection to proxy server

Add the following setting to the http items of .gitconfig files.

[http]
  proxy = <address of the proxy server>:<port of the proxy server>

You can also configure it using the following config command:

$ git config --global http.proxy <address of the proxy server>:<port of the proxy server>

Establish HTTP connection to user authenticated proxy server

Add the following setting to the http items of .gitconfig files.

[http]
  proxy = http://<username>:<password>@<address of the proxy server>:<port of the proxy server>

You can also configure it using the following config command:

$ git config --global http.proxy http://<username>:<password>@<address of the
  proxy server>:<port of the proxy server>

Subscribe to our newsletter

Learn with Nulab to bring your best ideas to life