0

I just tried to do a force push to a remote branch like this:

$> git checkout myBranch
$> git rebase origin/master
$> git push --force origin/myBranch

fatal: 'origin/myBranch' does not appear to be a git repository
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

I know I have the branch remote (I do normal pushes al the time) so I guess there is something wrong with the --force or the origin/myBranch. Can someone explain to me what the correct syntax is here ? Thanks a lot!

Jeanluca Scaljeri
  • 26,343
  • 56
  • 205
  • 333

1 Answers1

3

do:

git push --force origin myBranch

In general, it looks like this

git push <remote> <sourceBranch>:<destBranch>

where if the source branch (the one in your local fork) and destination branch (the one in the remote fork) are named the same, you just need to give the one name and git will do the right thing.

Chris Tavares
  • 29,165
  • 4
  • 46
  • 63