Installing Git on Ubuntu 12.04

Git installs as a normal package on Ubuntu Server 12.04.2 LTS:

sudo apt-get install git

Configuring Git user is an optional step:

git config --global user.email "you@example.com"
git config --global user.name "Your Name"

Type the following command to create an empty repository wherever your code is:

cd ~
git init

Now all the initialization is done.  Add something to the repository:

git add www
commit -m "first commit"

Other Git commands:

List files in the repository git ls-files
Undo local changes git checkout — <filename>
List changed files those you need to commit git status <directory>
Commit changes git commit –m “message” <directory>

Leave a Reply

Your email address will not be published. Required fields are marked *