user3855944
user3855944

Reputation:

Trying To Put Project On Github

I am trying to put my project on github following instructions given here:https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line

But is not allowing me to push my project on github showing error:failed to push some refs to . It also shows following hints.

hint: Updates were rejected because the tip of your current branch is to be
hint: its remote counterpart. Integrate the remote changes (e.g.
hint: 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.

**

I have tried to figure out the meaning of it but failed.

Please help me

Upvotes: 1

Views: 87

Answers (1)

VonC
VonC

Reputation: 1323223

That happens if you have created a non-empty GitHub repo (ie one with a README.md, a .gitignore and a LICENSE file): it has at least one commit of its own.

One easy solution is to delete/recreate your GitHub repo (if it was a new one), selecting the option to create an empty repo.
Simpler (if you don't want to keep the GitHub repo history)

git push --force -u origin master

If you cannot touch the GitHub repo, then you must precede your git push with:

git pull --rebase origin master

Then you can do a:

git push -u origin master

Note the -u option: see "Why do I need to explicitly push a new branch?" for more.

Upvotes: 1

Related Questions