git reset --hard origin/master failing
<p>Trying to discard changes on server, and make it exactly the same as origin/master:</p>

<pre><code>git fetch --all
git reset --hard origin/master
</code></pre>

<p>I've done this before on same repo without problems, but this time it fails with the following:</p>

<pre><code>fatal: Could not reset index file to revision 'origin/master'
</code></pre>

<p>Have tried the following:</p>

<ol>
<li><p>remove index and reset as suggested <a href="https://makandracards.com/makandra/5899-how-to-fix-a-corrupt-git-index" rel="noreferrer" title="here">here</a>:</p>

<pre><code>rm .git/index
git reset
</code></pre></li>
<li><p>also suggested <a href="https://stackoverflow.com/questions/13635429/git-rename-from-index-lock-to-index-failed">here</a> that some process could have a lock on .git\index. That killing process and then executing <code>git reset</code> could fix it, but not sure how to check if something has a lock on file remotely. Also seems that removing index file and reset would have had same effect.</p></li>
</ol>

<p>Loosing my mind. Would really appreciate any help.</p>