Git environment settings
Before you can use Git, you must install and make some configuration changes. Here are the steps to install Git client on Ubuntu and Centos Linux.
Install Git client
If you are using Debian distributed by GNU / Linux, the following apt-get command is required.
root @ ubuntu: ~ # sudo apt-get install git-core
[sudo] password for root:
root @ ubuntu: ~ # git --version
git version 1.9.1
And if you are using RPM distributed by GNU / Linux, you use the yum command as below:
[CentOS ~] $
su -
Password:
[CentOS ~] # yum -y install git-core
[CentOS ~] # git --version
git version 1.7.1
Customize Git environment
Git provides a git configuration tool that allows you to set up various configurations. Git saves all common configurations in the .gitconfig file located in your home directory. To set up configuration values like a global, you add the --global option, and if you want to remove this option, your configurations are specifically defined for the current Git repository.
You can also set up empty configuration for the system. Git stores the values in / etc / gitconfig, which contains configuration for all users and repositories on the system. To set these values, you must have the right root and use the --system option.
When the above code is compiled and executed, it produces the following result:
Set user name
This information is used by Git for every commit.
root @ ubuntu: ~ # git config --global user.name "QTM"
Set up email id
This information is used by Git for every commit.
root @ ubuntu: ~ # git config --global user.email "QTMteam@gmail.com"
Avoid merging commits when pulling
You pull the latest changes from the remote repository and if these changes are different or divergent, then by default Git creates merged commits. We can avoid this according to the following settings:
root @ ubuntu: ~ git config --global branch.autosetuprebase always
Floating color
The following commands create color in the Git control panel.
[root @ ubuntu: ~ git config --global color.ui true
[root @ ubuntu: ~ git config --global color.status auto
[root @ ubuntu: ~ git config --global color.branch auto
Set the default editor
By default, Git uses the default editor, which is taken from VISUAL or EDITOR. You can specify another editor using config.
[root @ ubuntu: ~ git config --global core.editor vim
Set the default merging tool
Git does not provide a default merging tool for interacting with opposing changes in the working tree. You can set up this tool according to the following settings:
[root @ ubuntu: ~ git config --global merge.tool vimdiff
List Git settings
To verify the Git settings in the local repository, use the git config –list command as shown below.
root @ ubuntu: ~ # git config --list
The above command will produce the following result:
user.name = Viet Jack
user.email=QTMteam@gmail.com
push.default = nothing
branch.autosetuprebase = always
color.ui = true
color.status = auto
color.branch = auto
core.editor = vim
merge.tool = vimdiff
According to Tutorialspoint
Previous article: Basic about Git
Next lesson: Git life cycle
You should read it
- How to Set Default Email Client in Windows 11
- 5 install Microsoft Word you should customize
- 6 best email apps for Mac
- How to Create a Mail Merge in Publisher
- Launch Email editor quickly from web browser
- Install and use Claws Mail in Windows
- Customize settings or change Microsoft Office with Office Deployment Tool
- How to use Snipping Tool on Windows 10 full set
May be interested
- Change these 6 settings on One UI 7 now!the one ui 7 update has brought a fresh look and some visual changes to samsung galaxy phones. however, there are some default settings that you should try changing before you get too used to them.
- How to configure TCP/IP settings in Windowsyour computer needs a way to communicate with other devices, and that's where tcp/ip comes in. tcp/ip ensures that data moves smoothly across the network, whether you're browsing the web or sharing files.
- How to sync settings on Windows 10with the option of synchronizing settings, windows 10 allows users to use the same settings on devices without time-consuming repetition but manual customization.
- How to check the desktop environment you are using on Linuxas you probably know, linux-based operating systems are heavily focused on the command line to perform operations. a minimal distro like arch linux will give you a dark terminal installation.
- Learn about LXQt desktop environmentwhen looking for a lightweight linux desktop environment to speed up your pc, the name you can't help but mention is lxqt. so what is lxqt? and what makes it different.
- How to search for settings options in the Settings menu on Androidlike other operating systems, android possesses 'countless' different settings options. these settings help optimize the user experience, but they also make the settings menu look like a 'mess' at times.
- How to add an environment variable in Windows 10windows 10 allows you to change or add custom environment variables. here are the steps to add an environment variable in windows 10.
- How to change advanced settings hidden in the browserthe browser has many settings, the option is hidden. each browser has a place where you can change many advanced settings, not in your standard options window.
- New features in the Settings application on Windows 11microsoft has completely redesigned the user interface in windows 11, which means many apps from windows 10 will now look different. one of them is the settings app.
- 5 reasons why Linux distros create their own desktop environmentmost of us don't think of the desktop as separate from the operating system. the desktop is what you see on the screen - as with windows or macos. on linux, desktop options are extremely diverse.