- Create system "/etc/gitconfig" configuration file which is the system wide configuration file:
1. Create new "system name" to be added on whole system:
2. Now, list the current Git attributes:
Set "vim" editor as the default editor we will use:
- Let 'more' command being the Git Pager:
- From time to time, there are files you don't want Git to check. so do the following:
1. Create exclude file:
2. Configure Git to use above exclude file:
1. Create new "system name" to be added on whole system:
[root@git-server ~]# git help config
--system
For writing options: write to system-wide $(prefix)/etc/gitconfig rather than the repository .git/config.
[root@git-server ~]# git config --system system.name "Git Repo Server 1"
[root@git-server ~]# cat /etc/gitconfig [system] name = Git Repo Server 1Note: /etc/gitconfig was not created, it is created after applying above Git command.
2. Now, list the current Git attributes:
[root@git-server ~]# git config --list system.name=Git Repo Server 1 user.name=Root User user.email=root@localhost- Overwrite "system.name" in /etc/gitconfig":
[root@git-server ~]# git config --global system.name " My Git Repo Server1" [root@git-server ~]# git config --list system.name=Git Repo Server 1 user.name=Root User user.email=root@localhost system.name= My Git Repo Server1 <------
root@git-server ~]# pwd /root [root@git-server ~]# cat .gitconfig [user] name = Root User email = root@localhost [system] name = " My Git Repo Server1"
Set "vim" editor as the default editor we will use:
[root@git-server ~]# git config --global core.editor vim
[root@git-server ~]# pwd /root [root@git-server ~]# cat .gitconfig [user] name = Root User email = root@localhost [system] name = " My Git Repo Server1" [core] editor = vim
[root@git-server ~]# git config --list system.name=Git Repo Server 1 user.name=Root User user.email=root@localhost system.name= My Git Repo Server1 core.editor=vim
- Let 'more' command being the Git Pager:
[root@git-server ~]# git config --global core.pager 'more'
[root@git-server ~]# pwd /root [root@git-server ~]# cat .gitconfig [user] name = Root User email = root@localhost [system] name = " My Git Repo Server1" [core] editor = vim pager = more
[root@git-server ~]# git config --list system.name=Git Repo Server 1 user.name=Root User user.email=root@localhost system.name= My Git Repo Server1 core.editor=vim core.pager=more
- From time to time, there are files you don't want Git to check. so do the following:
1. Create exclude file:
[root@git-server ~]# pwd
[root@git-server ~]# vim .gitignore_global
[root@git-server ~]# cat .gitignore_global *~ .DS_Store
2. Configure Git to use above exclude file:
[root@git-server ~]# pwd /root [root@git-server ~]# vim .gitignore_global [root@git-server ~]# cat .gitignore_global *~ .DS_Store
[root@git-server ~]# git config --global core.excludesfile ~/.gitignore_global
[root@git-server ~]# pwd /root [root@git-server ~]# cat .gitconfig [user] name = Root User email = root@localhost [system] name = " My Git Repo Server1" [core] editor = vim pager = more excludesfile = /root/.gitignore_global
[root@git-server ~]# git config --list system.name=Git Repo Server 1 user.name=Root User user.email=root@localhost system.name= My Git Repo Server1 core.editor=vim core.pager=more core.excludesfile=/root/.gitignore_global
No comments:
Post a Comment