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.
- I tried to reinstall GitLens.
- Reinstalled Visual Studio Code
- Removed all the extensions in
~/.vscode/extensions
- 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.
CodePudding user response:
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:
- Upgrade Git: 2.34, just released, fixes the bug.
- Downgrade Git: pre-2.30 or so doesn't have the bug.
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
.