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

Boris Kamp
Boris Kamp
16,660 Points

I cannot push to clone from origin

Hi guys!

Everything from this whole tutorial went great all the time, until I tried to push from my origin to the our-clone repo.

When I make a change in the origin repo to file1, I hit git commit -a -w "example" now when I hit up git status it gives me the message: On branch master Your branch is ahead of 'our_clone/master' by 1 commit. (use "git push" to publish your local commits)

okay, fair, then I try git push our_clone and all it does is echo back Everything up-to-date

like c'mon, whats wrong here? Im sure I use the right remote as git remote echos our_clone

The first time I did this it gave me this error:

"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"

then I used git push --set-upstream our_clone master and now I cannot push.

trying git status after the push echos back everything is fine and up-to-date

David Bath
David Bath
25,940 Points

Are you sure that command

git push --set-upstream our_clone master

didn't work? Did you check the remote repo for your changes?

Boris Kamp
Boris Kamp
16,660 Points

I tried it again this morning:

Boriss-MacBook-Pro:repo_01 boriskamp$ git push --set-upstream our_clone master
Branch master set up to track remote branch master from our_clone.
Everything up-to-date

you can see the result...

when I try the push again, I still get Everything up-to-date all the time. The only way to get the changes to the clone repo is by pulling from the clone repo, this works flawlessly.

Im not creating anything real here, just trying to follow all the steps from the videos, unfortunately, pushing from origin to clone does not work yet.

4 Answers

Garrett Sanderson
Garrett Sanderson
12,735 Points

If this is a brand new repository you may need to create an actual commit first before pushing the code to the repository.

git add .  // this will add all untracked files and stage them to be ready to be pushed into a commit
git commit -m 'initial commit' // adds all the files that you just staged into the commit
git push // pushes the commit to github under your master branch
Boris Kamp
Boris Kamp
16,660 Points

Thanks for the tip Garret, however, this is not the case. I've made like 8 commits already Any other ideas?

David Bath
David Bath
25,940 Points

Did you try simply

git push origin master

?

Same issue, but no solution yet.