Initialise new repository and push

Change to the project directory. Ensure .gitignore file has been created in directory and initialise git repository.

git init
git add .
git commit -m "Bootstrap project"

Create new repository in GitHub and push

git remote add origin
git push -u origin master

Simple clone, add, commit and push


git clone
git clone


git status

Add all, new and modified or modified and delete.

git add -A
git add .
git add -u

Commit changes

git commit


git push


git pull

Credentials Helper

The credentials helper can help reduce password re-entry for HTTPS URLs. Note that For SSH URLs a SSH key is used to authenticate. Enable the credentials helper on OSX with - see Caching your GitHub password in Git for other systems.

git config --global credential.helper osxkeychain

Create a downstream only fork.

This pattern is useful for small prototypes and learning exercises based on base line project with no intention to push changes back upstream. Create “my-exercise” repository in GitHub web interface

git clone my-exercise
cd my-exercise
git remote set-url origin
git push -u origin master

Add upstream repository and disable upstream pushes

git remote add upstream
git remote set-url --push upstream DISABLE
git remote -v

To sync the fork, you can fetch upstream changes and merge into local master

git fetch upstream
git checkout master
git merge upstream/master