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

Ruby Build a Simple Ruby on Rails Application Getting Started with Rails Push to GitHub

Steven Meyer
Steven Meyer
933 Points

Push failed

C:\projects\treebook [master]> git remote set-url origin https://github.com/stev elmeyer/treebook/

OK here's what I did to get this to work.

at command line on my computer (Windows 7) I typed:

C:\projects\treebook [master]> git remote set-url origin https://github.com/{insert your github id}/treebook/

NB: NOT "treebook.git" but "treebook/"

Then I typed:

C:\projects\treebook [master]> git push --set-upstream origin master

That worked

NB: I did not initialise my repository with a README. That produced a different sort of error.


**************Here's a cut and paste from my command line********************************************

C:\projects\treebook [master]> git remote set-url origin https://github.com/{insert your github id}/treebook/ C:\projects\treebook [master]> git remote -v origin https://github.com/{insert you github id}/treebook/ (fetch) origin https://github.com/{insert you github id}/treebook/ (push) C:\projects\treebook [master]> git push 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 origin master

C:\projects\treebook [master]> git push --set-upstream origin master

************************ GOT AN ERROR *********************************************************************

To https://github.com/{insert you github id}/treebook/ ! [rejected] master -> master (fetch first) error: failed to push some refs to 'https://github.com/{insert you github id}/treebook/' hint: Updates were rejected because the remote contains work that you do hint: not have locally. This is usually caused by another repository pushing hint: to the same ref. You may want to first integrate the remote changes hint: (e.g., 'git pull ...') before pushing again. hint: See the 'Note about fast-forwards' in 'git push --help' for details.



{At this point I deleted my github treebook repository and created a brand new one with no initial README.md}


C:\projects\treebook [master]> git push 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 origin master

C:\projects\treebook [master]> git push --set-upstream origin master Counting objects: 87, done. Delta compression using up to 8 threads. Compressing objects: 100% (75/75), done. Writing objects: 100% (87/87), 30.44 KiB | 0 bytes/s, done. Total 87 (delta 2), reused 87 (delta 2) To https://github.com/{insert you github id}/treebook/

  • [new branch] master -> master Branch master set up to track remote branch master from origin. C:\projects\treebook [master]>

************************************************ END CUT AND PASTE *******************************************

WITH MANY THANKS TO THE GOOD FOLKS AT STACK EXCHANGE