Git Academy

Beginner · 5 min read

Put your project on GitHub

Connect a local repository to GitHub, push it, and clone it elsewhere.

Create an empty repository on GitHub

On github.com, click New repository. Leave “Add a README” unticked if your project already has commits: an empty repository avoids a first conflict.

Connect and push

origin is the usual name of the remote. -u links your main branch to it, so next time a plain git push is enough. SSH URLs avoid typing a password: see our SSH key setup tool.

Safe
$ git remote add origin git@github.com:OWNER/REPO.git
$ git push -u origin main

Get a project from GitHub

git clone downloads the whole repository, history included, and sets origin for you. Then git pull keeps it up to date.

Safe
$ git clone git@github.com:OWNER/REPO.git
$ cd REPO
$ git pull