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 Git Basics Working With Remote Repositories Pushing and Pulling

Git Push - No upstream branch

I tried to push changes from my original repository using 'git push our_clone'

however I get the error message:

"fatal: The current branch master has no upstream branch. To push the current branch and set the remote as upstream use

git push --set-upstream our_clone master"

I have had this error message at other times ("no upstream branch") when trying to push to the original.

I am using the OS X terminal.

What does it mean?

Thanks !

3 Answers

Jake,

You need to configure the remote first, then push.

git remote add origin url-to-your-repo

Here are instructions.

Brendan Moran
Brendan Moran
14,052 Points

I'm having the same problem. I configured the remote first, but it still gave me the "no upstream branch" error. This went both ways, both when I tried to push from the clone, and when I tried to push to the clone from the origin. I configured first, but things still didn't work until I did git push --set-upstream ...

Roman Mayer
Roman Mayer
10,925 Points

Same problem here. I had added the remote already :/

Boban Talevski
Boban Talevski
24,793 Points

I assume this is happening due to different git versions. What I did to make it work at this point was to use the "trick" from a bit earlier in the video to add the branch name, for which you need to add the repository name first, as in:

git push origin new_feature

I didn't want to bother with setting an upstream yet as it's probably another concept not (yet) covered in the video :).

David Bayley
David Bayley
10,312 Points

Was happening to me then I realized I was trying to push while still checked into "new_feature" branch. Check back into the master of your clone repo and you'll be good to go.