Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

failed to fetch commits and branches #737

Closed
alete89 opened this issue May 6, 2019 · 10 comments

Comments

Projects
None yet
10 participants
@alete89
Copy link

commented May 6, 2019

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%
@nakinx

This comment has been minimized.

Copy link

commented May 6, 2019

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

@Cheng-Ya

This comment has been minimized.

Copy link

commented May 7, 2019

same error

@tksbng

This comment has been minimized.

Copy link

commented May 7, 2019

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

@terry623

This comment has been minimized.

Copy link

commented May 7, 2019

Same Error 😢

@GargIT

This comment has been minimized.

Copy link

commented May 7, 2019

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

@WispAmulet

This comment has been minimized.

Copy link

commented May 7, 2019

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
@owkwen

This comment has been minimized.

Copy link

commented May 7, 2019

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)

@alete89

This comment has been minimized.

Copy link
Author

commented May 7, 2019

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

@ifinik

This comment has been minimized.

Copy link

commented May 10, 2019

duplicate of 734, that duplicate if this
wat?

@eamodio eamodio reopened this May 10, 2019

@eamodio

This comment has been minimized.

Copy link
Owner

commented May 10, 2019

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.

@eamodio eamodio closed this in 7d24a40 May 10, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.