Pages

Subscribe:

Saturday, May 2, 2015

Git Installation and Basic configuration

You can simply install git using the yum

# yum install git

It will resolve the dependencies for you mostly comprising of the perl which git actually uses and will install the git.

Next configure a global username and email id

~ $ git config --global user.name "Root User"
~ $ git config --global user.email "[email protected]"

This would actually create an .gitconfig file which will hold your details

~ $ ls -ltr .gitconfig
-rw-r--r--. 1 root root 49 May  1 17:35 .gitconfig
~ $ pwd
/root

~ $ cat .gitconfig
[user]
        name = Root User
        email = [email protected]

You may also list the details using the following command

~ $ git config --list
user.name=Root User
[email protected]

Git is designed to take the parameters locally and globally , so you may set additional parameters and can even set the same parameters to have different value both locally and globally

$ git config --system system.name "Git Repo Server 1"
$ git config --list
system.name=Git Repo Server 1
user.name=Root User
[email protected]

$ git config --global system.name "My Git Repo Server1"
$ git config --list
system.name=Git Repo Server 1
user.name=Root User
[email protected]
system.name=My Git Repo Server1

You can also set the editor in the git that you are going to use

~ $ git config --global core.editor vim
~ $ cat .gitconfig
[user]
        name = Root User
        email = [email protected]
[system]
        name = My Git Repo Server1
[core]
        editor = vim

It is also possible to define the page option in git whether it would be less or more. By default its less if nothing is specified you may use more

~ $ git config --global core.pager 'more'
~ $ git config --list
system.name=Git Repo Server 1
user.name=Root User
[email protected]
system.name=My Git Repo Server1
core.editor=vim
core.pager=more




Further you may also create file to include the ignore parameters which git will ignore during the commit

~ $ vim .gitignore_global
~ $ cat .gitignore_global
*~
~ $ git config --global core.excludesfile ~/.gitignore_global
~ $ git config --list
system.name=Git Repo Server 1
user.name=Root User
[email protected]
system.name=My Git Repo Server1
core.editor=vim
core.pager=more
core.excludesfile=/root/.gitignore_global

~ $ cat .gitconfig
[user]
        name = Root User
        email = [email protected]
[system]
        name = My Git Repo Server1
[core]
        editor = vim
        pager = more
        excludesfile = /root/.gitignore_global

0 comments:

Post a Comment