#Setup Git in Ubuntu
OS: Linux
Version: Ubuntu 14.04 LTS
```
##Setup git
* Download and Install
```
$ sudo apt-get install git
```
* Setup a Folder on your server you wish to use for git
```
$ mkdir folder_name
$ cd folder_name
```
##SSH Key Setup
* Check for existing keys
```
$ cd ~/.ssh
$ ls -alh
```
* If they do not exist run the following command (accept the defaults)
```
$ ssh-keygen -t rsa -C "systems@tripattern.com"
```
* Copy contents of id_rsa.pub to Github
* Go to Github
* Account Settings (Top right)
* SSH Keys
* Add SSH Key
* Paste & Save (Use any name for Title)
* Test SSH key
* ssh -T git@github.com
* Respond "yes" to prompt and check if successful!
##Configure git and related github projects
* Initialize git in your github folder you created
```
$ git init
```
* Link to github repo
```
$ git remote add origin git@github.com:tripattern/repo_name.git
```
* PS you can use any name for origin it is a unique identifier
* Origin is a shortened name for the url given at the end of the command
## Download (Pull) the Repo
```
$ git pull origin #pulls all branches and the master repo from remote repo to a local repo
$ git pull origin master # if you just want the master repo
$ git pull origin <branch name> #if you just want a specific branch
```
## Change between braches and master
* THIS ONLY WORKS IF YOU SAID: git pull origin
```
$ git checkout <master or branch name>
```
## Check which branch you are using
```
$ git branch # show current local branch
$ git branch -a # shows current local branch and list of all local branches!
```
## Commit new files
* Initially you need to tell git who you are
* Globally for all commits on this System
```
$ git config --global user.email "you@example.com"
$ git config --global user.name "Your Name
```
* Just for this repository
```
$ git config user.email "you@example.com"
$ git config user.name "Your Name"
```
* Now begin the process of adding your file...
```
$ git add <file_name> # only for new files...
$ git commit -m "first commit"
$ git push -u origin <master or branch name>
```
## Update file on remote repo
```
$ git commit -a -m "Replaced incorrect semi-colon
$ git push -u origin <master or branch name>
```
* Set http://stackoverflow.com/questions/2596805/how-do-i-make-git-use-the-editor-of-my-choice-for-commits
## Pull Changes from github
```
$ git pull origin <master or branch name> # updates local files
$ git commit -a -m "Changed some files"
```
* Or if you'd like to have only certain files, but still not run git add we pass specific files.
```
$ git commit -m "change some files" file1 file2
```
## Clone Specific Branch
* git clone --branch 7.0 https://github.com/OCA/geospatial.git
##References