Skip to content

Instantly share code, notes, and snippets.

@esilvas
Created July 31, 2012 12:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save esilvas/3216738 to your computer and use it in GitHub Desktop.
Save esilvas/3216738 to your computer and use it in GitHub Desktop.
Useful Git Commands

Useful Git Commands

Setup Git Global Variables

Copied from Github: https://help.github.com/articles/set-up-git

Tell git your name:

$git config --global user.name "Your Name Here"
# Sets the default name for git to use when you commit

Tell git your email address:

$git config --global user.email "your_email@youremail.com"
# Sets the default email for git to use when you commit

Generate SSH Keys

Github has a great resource here: https://help.github.com/articles/generating-ssh-keys

Setup & Push File to Rep

Go to your existing folder:

cd /to/my/folder

Initialize local git repo in that folder:

git init

Add existing files to local repo and commit:

git add .
git commit -m "Initial submission."

Add remote:

git checkout master
git remote add origin me@my.git.server.com:project.git

Clone Existing Repo

To clone an existing repository, run the following command.

git clone git://github.com/schacon/simplegit.git

This will create a folder name 'simplegit' within the current working directory. If you would like an alternate name for the folder, try:

git clone git://github.com/schacon/simplegit.git newfolder

Remove file from Index

git rm --cached notes.txt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment