In this tutorial you will learn how to use Git config on Ubuntu Server.
Code used during this tutorial:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 |
# Git config on Ubuntu Server ssh ubuntu-vm su liviu.balan cd /var/www/http.liviubalan.com # Create an empty Git repository git init git add index.php git commit -am "commit message" git log #*** Please tell me who you are. # #Run # # git config --global user.email "you@example.com" # git config --global user.name "Your Name" # #to set your account's default identity. #Omit --global to set the identity only in this repository. # #fatal: unable to auto-detect email address (got 'liviu.balan@UbuntuVM.(none)') # 1. System configuration level # Values for every user on the system and all of their repositories vi /etc/gitconfig sudo git config --system user.email "liv_romania@yahoo.com" sudo git config --system user.name "Liviu Balan" # 2. Global configuration level # Specific to each user vi ~/.gitconfig git config --global user.email "liv_romania@yahoo.com2" git config --global user.name "Liviu Balan2" # 3. Local configuration level # Specific to a single repository vi /var/www/http.liviubalan.com/.git/config git config --local user.email "liv_romania@yahoo.com3" git config --local user.name "Liviu Balan3" # Each of these “levels” (system, global, local) overwrites values in the previous level # Personal recommendation: use global level in most of the client-side cases # Git’s configuration files are plain-text, so you can also set these values by manually editing # Useful config # Editor to create and edit commit and tag messages git config --global core.editor vi vi ~/.gitmessage.txt subject line what happened [ticket: X] # Default message when you commit git config --global commit.template ~/.gitmessage.txt # Recommended config git config --global user.email "liv_romania@yahoo.com" git config --global user.name "Liviu Balan" git config --global core.editor vi # If your team has a commit-message policy git config --global commit.template ~/.gitmessage.txt # List all variables set in config file, along with their values git config --list # More info about git config man git-config # Useful links https://git-scm.com/book/en/v2/Customizing-Git-Git-Configuration http://git-scm.com/docs/git-config.html |
Useful links
https://git-scm.com/book/en/v2/Customizing-Git-Git-Configuration
http://git-scm.com/docs/git-config.html