Why is `git push --force-with-lease` failing with "rejected ... stale info" even when my local repo is up to date with remote? : <p>I'm trying to force push a rebase of a feature branch to a remote repository. To be a bit safer, I'm trying to use <code>--force-with-lease</code> to make sure no other changes have happened in the branch since I last fetched it.</p>

<p>This is failing for reasons I don't understand:</p>

<pre><code>$ git branch
* my-branch
  master

$ git push --force-with-lease origin my-branch -u
To gitlab.com:example/my-project.git
 ! [rejected]        my-branch -&gt; my-branch (stale info)
error: failed to push some refs to 'git@gitlab.com:example/my-project.git'
</code></pre>

<p>I tried a fetch to see if my local cache had somehow gotten out of sync:</p>

<pre><code>$ git fetch

$ git push --force-with-lease origin my-branch -u
To gitlab.com:example/my-project.git
 ! [rejected]        my-branch -&gt; my-branch (stale info)
error: failed to push some refs to 'git@gitlab.com:example/my-project.git'
</code></pre>

<p>I tried simplifying the push command a bit:</p>

<pre><code>$ git push --force-with-lease
To gitlab.com:example/my-project.git
 ! [rejected]        my-branch -&gt; my-branch (stale info)
error: failed to push some refs to 'git@gitlab.com:example/my-project.git'
</code></pre>

<p>I tried limiting the check to my branch:</p>

<pre><code>$ git push --force-with-lease=my-branch:origin/my-branch
To gitlab.com:example/my-project.git
 ! [rejected]        my-branch -&gt; my-branch (stale info)
error: failed to push some refs to 'git@gitlab.com:example/my-project.git'
</code></pre>

<p>As you can see, it fails the same way every time.</p>

<p>Why is my push failing, and how do I fix it?</p>
