Vscode-gitlens: failed to fetch commits and branches

Created on 6 May 2019  路  11Comments  路  Source: eamodio/vscode-gitlens

Issue Type: Bug

I got this error every time I try to see the list of commits or branches under GitLens tab.
Command failed: git -c core.quotepath=false -c color.ui=false for-each-ref --format=%3ch%3e%(HEAD)%3cn%3e%(refname:lstrip=1)%3cu%3e%(upstream:short)%3ct%3e%(upstream:track)%3cr%3e%(objectname) refs/heads refs/remotes fatal: unknown refname: format lstrip=1

This started happening right after last update in all my repos.

short demo: https://youtu.be/nslVqFNpeSU

Extension version: 9.7.1
VS Code version: Code 1.33.1 (51b0b28134d51361cf996d2f0a1c698247aeabd8, 2019-04-11T08:20:22.771Z)
OS version: Linux x64 4.9.0-9-amd64


System Info

|Item|Value|
|---|---|
|CPUs|Intel(R) Core(TM)2 Quad CPU Q8400 @ 2.66GHz (4 x 2003)|
|GPU Status|2d_canvas: enabled
checker_imaging: disabled_off
flash_3d: enabled
flash_stage3d: enabled
flash_stage3d_baseline: enabled
gpu_compositing: enabled
multiple_raster_threads: enabled_on
native_gpu_memory_buffers: disabled_software
rasterization: disabled_software
surface_synchronization: enabled_on
video_decode: unavailable_off
webgl: enabled
webgl2: enabled|
|Load (avg)|1, 1, 1|
|Memory (System)|3.74GB (0.44GB free)|
|Process Argv|--unity-launch|
|Screen Reader|no|
|VM|0%|


bug

Most helpful comment

Sorry closed this the wrong way originally -- and this will be fixed in 9.7.2 which will be released very shortly. Sorry for the issue and the delay in getting it fixed up.

All 11 comments

I think i'm having the same problem:

Command failed: /usr/bin/git -c core.quotepath=false -c color.ui=false for-each-ref --format=%3ch%3e%(HEAD)%3cn%3e%(refname:lstrip=1)%3cu%3e%(upstream:short)%3ct%3e%(upstream:track)%3cr%3e%(objectname) refs/heads refs/remotes
fatal: unknown refname: format lstrip=1

I can't open my local and remote branchs.

Version: 1.33.1
Commit: 51b0b28134d51361cf996d2f0a1c698247aeabd8
Date: 2019-04-11T08:20:22.771Z
Electron: 3.1.6
Chrome: 66.0.3359.181
Node.js: 10.2.0
V8: 6.6.346.32
OS: Linux x64 4.4.176-94.88-default
gitlens version 9.7.1
git version 2.12.3

same error

Same problem

Command failed: C:\Program Files\Git\cmd\git.exe -c core.quotepath=false -c color.ui=false for-each-ref --format=%3ch%3e%(HEAD)%3cn%3e%(refname:lstrip=1)%3cu%3e%(upstream:short)%3ct%3e%(upstream:track)%3cr%3e%(objectname) refs/heads refs/remotes
fatal: unknown refname: format lstrip=1

Same Error 馃槩

Getting the same error:

Command failed: /usr/bin/git -c core.quotepath=false -c color.ui=false for-each-ref --format=%3ch%3e%(HEAD)%3cn%3e%(refname:lstrip=1)%3cu%3e%(upstream:short)%3ct%3e%(upstream:track)%3cr%3e%(objectname) refs/heads refs/remotes
fatal: unknown refname: format lstrip=1

Same here.

Command failed: /usr/bin/git -c core.quotepath=false -c color.ui=false for-each-ref --format=%3ch%3e%(HEAD)%3cn%3e%(refname:lstrip=1)%3cu%3e%(upstream:short)%3ct%3e%(upstream:track)%3cr%3e%(objectname) refs/heads refs/remotes
fatal: unknown refname: format lstrip=1

vscode version: 1.33.1
gitlens version: 9.7.1

After read @owkwen's answer, I update git on my pc from version 2.11.0 to 2.20.1 and the previous error was gone. 馃帀

I'm on Debian 9 and I have tried to update git before, but the latest git version on stretch distribution is 2.11.0, so if anyone met this too, try edit /etc/apt/sources.list and use another distribution maybe like this or see SourcesList

deb http://httpredir.debian.org/debian/ stretch-backports main contrib
deb-src http://httpredir.debian.org/debian/ stretch-backports main contrib

I had this same error and here is why it happens and how to fix it:

The error fatal: unknown refname: format lstrip=1 is most probably related to the git version that gitlens is using, the _lstrip_ function isn't available on old git version.
On git's doc it looks like lstrip appeared in git 2.13.2.
If you use ubuntu for example, the most up to date version you can get from the repo is ~2.7.4, which doesn't support _lstrip_.

Here is what I used to get the latest version of git on ubuntu

With that, I got git version 2.21.0 and now gitlens' branches and contributors details are working and no error in sight!


For reference to people like me that are using vscode's remote-ssh extensions and don't understand why gitlens works locally but not on the remote system, it's again because your local machine may have a recent version of git that supports _lstrip_, but not the machine you are connected to ( which actually runs gitlens in this remote-ssh setup)

Thanks @owkwen . Anyway I would suggest gitlens not to use versions newer than provided in Ubuntu or Debian default repos :/

duplicate of 734, that duplicate if this
wat?

Sorry closed this the wrong way originally -- and this will be fixed in 9.7.2 which will be released very shortly. Sorry for the issue and the delay in getting it fixed up.

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

vgrafe picture vgrafe  路  3Comments

mindpivot picture mindpivot  路  4Comments

roblourens picture roblourens  路  4Comments

robertzauner picture robertzauner  路  3Comments

rfgamaral picture rfgamaral  路  3Comments