Skip to content

Instantly share code, notes, and snippets.

@billjohnston
Created April 28, 2012 19:15
Show Gist options
  • Save billjohnston/2521438 to your computer and use it in GitHub Desktop.
Save billjohnston/2521438 to your computer and use it in GitHub Desktop.
Installing / Using git
sudo apt-get install git
git config --global user.name Bill Johnston
***Doesn't have to be username***
git config --global user.email email@email.com
***Should be email associated w/ github account***
ssh-keygen -t rsa -C "email@email.com"
...Enter file in which to save the key (/home/ubuntu/.ssh/id_rsa): //press enter for default
...Enter passphrase (empty for no passphrase): //enter a password
...Enter same passphrase again: //again
...Your identification has been saved in /home/ubuntu/.ssh/id_rsa.
...Your public key has been saved in /home/ubuntu/.ssh/id_rsa.pub.
cat /home/ubuntu/.ssh/id_rsa.pub
***Go here: https://github.com/settings/ssh and paste the output as a new ssh key***
...Create a new repo: https://github.com/repositories/new
cd /var/www/(whatever directory you want to add a repo for)
git init
git add .
git remote add origin git@github.com:username/projectname.git
***Replace username and project name with yours. Command is listed on the new repo page***
git commit -m 'initial commit'
***-m describes the new content you are submitting***
git push -u origin master
...Enter passphrase for key '/home/ubuntu/.ssh/id_rsa': //the password you created earlier for the ssh key
DONE.
For future changes
git add .
***Will add everything that's in the heirarchy, including new files. Can also specify file if not all should be added***
git commit -m 'the message'
***Commits with message***
git push -u origin master
***Can change branch from master if desired***
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment