Block title

Helpful Git Commands

Note: Git requires SSH key pair authentication to access remote repositories.

Generate a 2048-bit RSA Encrypted SSH key pair for git and other services secured by SSH.

ssh-keygen -t rsa -b 2048

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 to copy and paste into your Remote Repository Host.

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 with the following command.

git config -l

Identify yourself to git with the following commands.

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


git config --global "John Doe"
git config --global

Please Note: 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 in a folder with the following command.

git init

Add all files and folders in your git repository folder to the local repository.

git add *

Add a single file to your git repository.

git add filename

git add readme.txt

Commit your changes to your local git repository.

git commit -am "explain your commit here."


git commit -am "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 to your computer or server that can be updated. (Read/Write)

git clone


git clone

Clone a Git repository to your computer that cannot be updated. (Read Only)

git clone git://


git clone git://

Block title

Signup for Dropbox and get 2GB free storage plus 500GB per referral