Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

General Discussion Creating a Project Pages Site

Why use origin in the push?

Why we use origin keyword in git when pushing it to a certain branch e.g. git push origin gh-pages?

1 Answer

Jennifer Nordell
Jennifer Nordell
Treehouse Teacher

Hi there! When you first made your repository you might remember doing a command like git remote add origin <link to repo>. At that point, you set up a sort of pointer to your remote repository named "origin". There is the possibility that at some point, however unlikely, that you could have multiple remote repositories (potentially for backup purposes). Each "remote" would need to be named something. Whenever you would then push to a remote branch it needs to know which remote branch it should push to. In this case, it's stating that you want to push your gh-pages branch to the remote repository that you previously aliased as "origin". To be clear, you can name that anything you like. In fact, I once spent about 3 hours pulling my hair out because I was not able to push only to discover that I had originally named my remote "orign" instead of "origin". Note that they differ by one letter.

Hope this helps! :sparkles:

Jennifer Nordell so remote is what is your repo, the origin is what name given to it?