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 trialY B
14,136 PointsChallenge: git push branch to remote repository
In the git tutorial I can get past the challenge where it asks to push to a remote repository
Q: Now that you've cloned that repository, let's say you've done some work on a branch named "awesome_stuff." What command would you run to push that branch up to your remote?
My answer: git push git://mygithosting.com/git_basics/cool_stuff.git. awesome_stuff
However this fails, but I'm not sure why?
3 Answers
Ken Alger
Treehouse TeacherY B;
Once you have cloned a repository Git recreates a remote named origin
for us. So, we would need to use:
git push origin awesome_stuff
Which does just what it sounds like, it pushes our awesome_stuff
branch back to the origin, which Git knows about.
Post back with further questions.
Ken
Y B
14,136 PointsThanks I thought that was a specific example in the tutorial not the general case. Does git always set it up as origin after cloning a repository?
Ken Alger
Treehouse TeacherIf you take a look at the documentation for clone
you will see that:
This default configuration is achieved by creating references to the remote branch heads under
refs/remotes/origin
and by initializingremote.origin.url
andremote.origin.fetch
configuration variables.
Happy coding,
Ken
Y B
14,136 PointsThanks