Welcome to the Treehouse Community
The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.
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?
Jennifer NordellTreehouse 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!