How To Install Latest Git in Ubuntu on Command Line

Install Git

To install Git in Ubuntu on the command line, open the Terminal by pressing:
Ctrl + Alt + T

The Ubuntu software repository doesn’t give you the latest Git, so I run these 3 lines to get the latest version of Git:

sudo add-apt-repository ppa:git-core/ppa
sudo apt-get update
sudo apt-get install git

See what version of Git you installed:

git --version

Configure Git

In the following commands, replace “Your Name” with your own name, and replace “you@example.com” with your own email address.

git config --global user.name "Your Name"

git config --global user.email you@example.com

Caching your GitHub password in Git

This saves your GitHub password on your local machine so that you don’t have to keep typing it in over and over again. Enabling the “Credential Helper” will, by default, save your password for 15 minutes after the first time you use it.

git config --global credential.helper cache

To change the cache timeout, for example, to save the password for 1 hour (3600 seconds), do this:


git config --global credential.helper 'cache --timeout=3600'

You can change the 3600 to whatever you need (in seconds). For 8 hours, use 28800.

See more: , ,

Questions and Comments are Welcome

Your email address will not be published. All comments will be moderated.

Please wrap code in "code" bracket tags like this:

[code]

YOUR CODE HERE 

[/code]