Some basic Git commands.

Creating a Git repository

If you already have a git repository made, you can skip this step. Otherwise you need to set-up a git repository.

Creating the repository in the command line

Go to GitHub, click “+” and Create New Repository Give it a title, and a short description.

Ignore the “initialize this repo with a README”

Click “Create repository”

Now we will push your current directory to this repo. Once you are within your repo:

git init
git add .  
git commit -m ’first push’  
git remote add origin  
git push -u origin master

where YOUR-GIT-USER is your GitHub username and REPO-NAME is the name of the repository you created.

Creating the repository via a client

Drag and drop you new folder on to the (probably empty) repository window. Then push to GitHub with the button in the upper right hand corner. You want to always allow GitHub to use your SSH KeyChain.

You can confirm a repository was made by going to GitHub and viewing your user profile. To add new files to the repository, go to the “Repository” heading in the Git client and click “open in finder.” From there one can add files by dragging and dropping, and then syncing.

Pushing Files

Unless you like vi you will want to set your basic editor. I suggest doing:

git config --global core.editor "nano"

When working with git, you will want to

You’ll need to pull your new repo. Create a file. Suppose its name is: first.tex
Type git add first.tex to stage the changes you’ve made to the first.tex file. Or do git add -u to add all updated files.
Type git commit -m "My first edit" to commit the staged changes. You can also just do: git commit