One of Stones
One of Stones

Reputation: 37

Keep getting error when pushing to git hub. Can somebody help me out

error: failed to push some refs to 'https://github.com/kokocat1313/Rusty' hint: Updates were rejected because the tip of your current branch is behind 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.

Upvotes: 2

Views: 92

Answers (1)

VonC
VonC

Reputation: 1326782

Using -f as you did in the comments means you have overriden the remote history (commits) by your local history (the commits done locally in your master/main branch)

That happens especially with new GitHub repositories initialized with a README (instead of being completely empty), while you initialized a local repository locally on your workstation (instead of cloning it)

Note that you should be using the branch main, not master.

git switch main

Upvotes: 2

Related Questions