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!

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

Development Tools Introduction to Git GitHub and Other Remote Repositories Pushing Commits to GitHub

Why do we use "git remote add origin..."?

Why do we use "git remote add origin https://github.com/ test/medals.git" when the origin is in the myclone dir?

2 Answers

I've pulled this from the teachers notes on the Pulling Changes video earlier in this module:

When you clone a Git repo, the original repo is automatically added as a remote on the clone. You can name remote repos whatever you want, but the default used when cloning is origin, because it represents the repo this clone originated from. Because of this default, you'll see a remote repo named origin on most Git repos you work with. In fact, in many cases, the origin repo will be the only remote repo, because everyone on the project just pulls changes from that single repo.

So in the earlier example medals was the origin of myclone but here we are setting up a remote repository to act as the origin for medals to show how a remote Git repo would be set up in situation where there is one online main repo that several people work from. I think.

to add a remote repo for your current directory