Git requires SSH key pair authentication to access remote repositories.

Generate a 2048-bit RSA Encrypted SSH key pair.

ssh-keygen -t rsa -b 2048

Generate a 4096-bit RSA Encrypted SSH key pair.

ssh-keygen -t rsa -b 4096

This should generate a file named in your /home/username/.ssh folder. You must copy this key and enter it into your user account for repository hosting services.

Display your Public Key.

cat ~/.ssh/

Sites such as Github, Unfuddle, and BitComet require your SSH Public Key to access their repositories. One you have added the key to your account you are ready to commit and clone repositories.

Check your current git identity.

git config -l

Identify yourself to git.

git config --global "Your Name"
git config --global


git config --global "John Doe"
git config --global
It is best to use your real name and your email address. That way people know commits are coming from you.

Initialize and create a new git repository.

git init

Add all files and folders to the local git repository.

git add *

Add a single file to your local git repository.

git add filename


git add readme.txt

Commit your changes to your local git repository.

git commit -m "explain your commit here."


git commit -m "initial commit"

Add a remote repository to your git repository.

git remote add remote-name git://


git remote add origin git://

Configure a branch on your remote repository as an upstream server.

git config remote.remote-name.push refs/heads/branch-name:refs/heads/branch-name


git config remote.origin.push refs/heads/master:refs/heads/master

Push your changes to your remote git repository.

git push -u remote-name branch-name


git push -u origin master

Clone a Git repository. (Read / Write)

git clone


git clone

Clone a Git repository . (Read Only)

git clone git://


git clone git://