gitgithubvisual-studio-codegitlens

GitLens unable to pull push in Visual Studio Code


I created a simple repository, edited an index.html file and published the changes to GitHub through Visual Studio Code GitLens. It works fine.

On a subsequent commit, it throws an error:

> git pull --tags origin main
From https://github.com/mySpecialRepo/myTest
 * branch            main       -> FETCH_HEAD
fatal: Not possible to fast-forward, aborting.

If I go to my local terminal and Git commit and push, it works.

  1. I tried to reinstall GitLens.
  2. Reinstalled Visual Studio Code
  3. Removed all the extensions in ~/.vscode/extensions
  4. Signed out of GitHub on the local machine and in Visual Studio Code as well.

Nothing works.

I'm on an M1 Visual Studio Code version.


Solution

  • What's happening here is that your repository is up to date. There's a small bug in Git that makes it complain that updating isn't possible (which is true: you're up to date! No update is possible, but none is needed: Git shouldn't complain, but it does) and this discombobulates Visual Studio Code.

    There are two solutions that don't involve ditching Visual Studio Code at least temporarily:

    There is also a workaround: configure pull.ff to true, which makes Git act like older versions that don't have a pull.ff setting of only.