0

Since a couple of weeks ago I've experienced a very annoying issue with git in Ubuntu on my Windows 10 system (WSL2). When doing a git fetch, pull or clone against a repo on Azure Devops it takes several minutes before something happens. Cloning from github is no problem and git in windows works just fine (including devops), it's only in Ubuntu and with devops this happens.

When searching for information about this the only related issues I've found people having is slow git performance when working from a mounted windows folder, but I'm working from the home folder in Ubuntu.

I'm using Docker devcontainers with WSL2 and the problem occurs there as well.

I have no idea what I did a couple of weeks ago that caused this!

Just look at this:

18:47:32.905545 read-cache.c:2306       performance: 0.000062544 s:  read cache .git/index 
18:53:48.594716 trace.c:475             performance: 0.000394139 s: git command: /usr/lib/git-core/git rev-list --objects --stdin --not --all --quiet --alternate-refs
18:53:48.602112 trace.c:475             performance: 0.001176611 s: git command: /usr/lib/git-core/git gc --auto
18:53:48.602259 trace.c:475             performance: 375.702683388 s: git command: git fetch -p
                                                     =============

.gitconfig in Ubuntu (the one in Windows is essentially the identical):

[user]
    name = Anders H*******
    email = anders.h***@*****.eu
[credential]
    helper = /mnt/c/Program\\ Files/Git/mingw64/bin/git-credential-manager.exe
[merge]
    tool = meld
[diff]
    tool = meld
[mergetool "meld"]
    keepBackup = false
    trustExitCode = false
[mergetool]
    prompt = false
[difftool "meld"]
    cmd = Meld.exe "$LOCAL" "$REMOTE"
[difftool]
    prompt = false
[credential "https://dev.azure.com"]
    useHttpPath = true

I had an idea that it could have something to do credential management. I had both Github CLI and Git for windows (with git-credential-manager) installed and my thought was that there where some conflict. So I uninstalled Github CLI and updated Git for Windows to the latest version. This had no effect.

Another thought is that it has something to do with the fact that I started working with Docker devcontainers in VSCode at about the same time when the issue started to occur. I have however not been able to find anything related to this.

Update

Using SSH I don't experience this issue, so it obviously has something to do with credential management. I do however have no clue to what it could be!

Zenit_swe
  • 121
  • 1
  • 6
  • After a slow fetch, is the next one right afterwards also slow? When it's slow, are you getting a lot of data for that fetch? – TTT Feb 09 '23 at 18:26
  • If your container is not persisting state, then every time you start it up it would need to re-fetch everything that changed since the initial state for that repo in the container. Over time that would grow bigger and bigger, and would obviously be slower than a repo that is persisted on your machine. So if your AzDO repo is large compared to the other repos this is a possible explanation. If it's small, or around the same size as the GitHub repos then this probably isn't relevant. (Also, if this is the problem, fresh clones in Windows would take about the same amount of time.) – TTT Feb 09 '23 at 18:32
  • 1
    @TTT There's no improvement on subsequent commands and the issue isn't exclusive for containers, the same happens if I just open an Ubuntu shell. I'm still thinking it has something to do with the credential management for Azure Devops but I don't have a clue where to look. – Zenit_swe Feb 10 '23 at 06:22

0 Answers0