Video Course

Get to Know Git: Lesson 7 of 14

Pushing Local to Remote

Up Next

Cloning Repositories

Autoplaying in 7 seconds!

Cancel

To view what remote repositories are attached to your current repo:

git remote -v

The default main remote repo is called the origin. If you don't yet have an origin set, you can set it using:

git remote add origin git@github.com:scotch-io/my-repo.git

Notice we are using the SSH url (git@github.com:scotch-io/my-repo.git) vs the HTTPS url (https://github.com/scotch-io/my-repo.git).

Once you've added that remote, you can push to it after telling git how to map the branches. Here we'll map master local branch to a master remote branch.

git branch --set-upstream-to=origin/master master

Then we can push!

git push

Chris Sevilleja

162 posts

Co-founder of Scotch.io. Slapping the keyboard until something good happens.