1

I have an existing repo that I want to add a new remote to, a sort of local repo for internal staging rather than pushing to origin.

I have created a new blank repo in GitHub, added the remote to my repo (with the name github) and tried :

git push github mybranch

I believe I have done this before and it worked, however now I'm getting an error telling me that updates were rejected because a pushed branch tip is behind its remote counterpart.

It wants me to git pull from the new repo - however it's empty.

What do I need to do in order for this to work? Is there a force option to just shove the code there?

shuttle87
  • 15,466
  • 11
  • 77
  • 106
  • 1
    Did you ask GitHub to create a `README.md`, `.gitignore` or `LICENSE` file for you when you created your repository? These options are all available from [the new repository form](https://github.com/new). – ChrisGPT was on strike Jun 05 '14 at 12:33
  • possible duplicate of [After creating a local git repo, how do I push it on Github?](http://stackoverflow.com/questions/11276364/after-creating-a-local-git-repo-how-do-i-push-it-on-github) – mort Jun 05 '14 at 14:52
  • @Chris, I think this was it. I used the -f (force?) flag as suggested below and it worked. Must be these files stopping it from being empty. Thanks again for the help. – user3711014 Jun 05 '14 at 15:17
  • possible duplicate of [Force git to overwrite remote files on push](http://stackoverflow.com/questions/10510462/force-git-to-overwrite-remote-files-on-push) – random Jun 08 '14 at 23:05

1 Answers1

0

Try this:

git push -f github mybranch
Sudhanshu Mishra
  • 2,024
  • 1
  • 22
  • 40