Installing Git in a Linux cPanel server

ultimatehostings

New Member
Verified Provider
Git is an open source software used for version control.

 

Before installing Git, it is important to set the environment and dependencies. The following command will install all the dependencies needed for Git.



# yum -y install zlib-devel openssl-devel cpio expat-devel gettext-devel
Downloading and Installing Git

 

Change to a convenient directory (/usr/local/ or /usr/local/src)



# wget http://www.codemonkey.org.uk/projects/git-snapshots/git/git-latest.tar.gz
# tar xvzf git-latest.tar.gz
# cd git-date
# autoconf
# ./configure --with-curl=/usr/local
# make 
# make install
The installation is completed now. But we need to do a bit of testing as well.



# cd mkdir git-test 
# cd git-test 
# git init
Here, we created a test directory called “git-test", entered into that directory and initialized a repository there. If everything works fine, you will get a message as said below.


Code:
Initialized empty Git repository in /root/git-test/.git/
 

drmike

100% Tier-1 Gogent
Good start, now that folks followed along, how do they start using Git and populating their repository?
 

ultimatehostings

New Member
Verified Provider
Thought would add a few examples;

git config

Sets configuration values for your user name, email, gpg key, preferred diff algorithm, file formats

git init
Initializes a git repository – creates the initial ‘.git’ directory in a new or in an existing project.

git clone
Makes a Git repository copy from a remote source. Also adds the original location as a remote so you can fetch from it again and push to it if you have permissions.

git add
Adds files changes in your working directory to your index.

git rm
Removes files from your index and your working directory so they will not be tracked.

git commit
Takes all of the changes written in the index, creates a new commit object pointing to it and sets the branch to point to that new commit.

git status
Shows you the status of files in the index versus the working directory.
 

rosehosting

New Member
Verified Provider
Here are a few more basic Git commands:

git pull

Fetch and merge changes from the remote repository to your local one.

git push

Send changes to the master branch of your remote repository.

git checkout

Checks out a different branch – replace the changes by updating the index, working tree, and HEAD to reflect the chosen branch.
 
Top