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

Development Tools

Edgar Castelo
PLUS
Edgar Castelo
Courses Plus Student 19,428 Points

What's the difference between "git remote add origin" and "git clone" ?

What is the difference between these two instructions? Are there any benefits in choosing one instead of the other?

1 Answer

git clone only creates a clone of a git project in a new directory. When you execute git remote add origin you are adding a remote for your git project to be able to pull and push from/to. The reason for that is because you might want to clone someone else's project but push to your own remote instead of the original one. Sometimes you also need more than one remote, so you can add as many as you need.

Edgar Castelo
Edgar Castelo
Courses Plus Student 19,428 Points

Thanks for the answer, in order to complement and according to the git documentation git clone implicitly adds the remote when cloning the repo.