You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
git clone --bare git@github.com:example/example.git example
And added the main branch as a worktree
git worktree add main
Now, if I go into the main directory and I tree to run lazygit it just crashes after opening for like half a second.
I cannot get the full panic because it also leaves my terminal in a messy state.
@mark2185 Interesting, it really doesn't reproduce on the lazygit repo. The repo where I run into this panic is private so I can't just share that. I'll try to find what causes this and create an example that reproduces.
This may be related to a bare-repo crash in #3175, which is fixed in (currently open) PR #3183. If you're feeling ambitious, pull my branch in that PR and give it a whirl. Otherwise, retest after that PR lands and is released in hopefully not too long.
I tried it with your PR branch but I still get this crash.
Also, the repo does not have symlinks but it does have additional repos cloned inside it.
If I try to use worktrees on the same repo but with a normal clone instead of a bare clone it seems to work fine.
Thanks for the feedback on the PR. I just tried it with the PR branch, and I'm unable to repro. I used a workflow similar to the one above, but I don't place the worktree inside of the bare repo, but next to it (by using env GIT_DIR=`realpath test` git worktree add main).
Obviously there's a crash here, but at least the basic regular/bare repo plus worktree cases seem to work. I think there's something about the specific private repo that's probably triggering the crash. You mentioned that there are other repos cloned into the first one? Are these submodules, or some more unusual clone-inside-a-clone workflow?
If you're able to discover a repro workflow, perhaps using dummy repositories that mimic the cloning organization you mention, that would be a huge help.
FYI, PR #3183 matured a bit, catching additional edge cases, and has been merged. If you have time, I'd love to know if your issue still reproduces on master. It's plausible that your scenario did eventually get fixed.
I switched jobs and am no longer able to access the repo that caused this issue, so I can't ever say if this is fixed or not.
To answer your last question, it was a more unusual clone-inside-clone workflow but even if I removed the clones inside the crash still occured.
From my point of view I would be fine with closing this issue as I won't be able to tell if the issue is fixed or not.
Again thank you for the great work you are doing here, I love using lazygit.
I'm having this issue right now. Just did a git clone --bare ... and git worktree add master. Without doing bare I was not having this issue at all in the repo.
@voylin I'm still unable to repro, using lazygit v0.43.1. In samples above, this seemed to be repository dependent somehow. Is this happening for a public repository that you can share here? Alternatively, if you were able to create a public repo that reproduced the problem that would be a big help. Perhaps there's some unusual characteristic of your problem repo that's triggering the crash?
As it is, the underlying code had a major refactor and doesn't crash for similar workflows myself and others have tried in order to reproduce.
The steps I took were just a git clone bare of the repo, and adding the master branch with git worktree add. I got the problem fixed by just creating a folder with the repo name, using git clone but naming that folder master and in the same folder I added a worktree for the other branch. This works for me.
If you want I could try to replicate the issue and try to get some error logs or something to see if this is an actual issue or just me being dumb in setting up a git bare repo ^^"
Thanks @voylin, that's helpful. Let me see if I've got this right:
git clone --bare https://github.com/VoylinsGamedevJourney/GoZen_lite bare
env GIT_DIR=$(realpath bare) git worktree add main – this adds the worktree main alongside the repo bare, i.e. both have the same parent directory.
cd main
lazygit
That workflow isn't crashing for me on lazygit 0.43.1. If you're doing something different when you see the crash, it would be great to know what the exact steps are, since clearly some users hit roadblock here. (and even if the fix is "don't crash, and provide some usage guidance")
Last but not least, I also tried putting a worktree inside of the bare repo directory (which is super weird, since it's the git data directory), but that didn't crash either.
I am getting this error as well, specifically with worktrees. I can provide repro steps and try recloning the directory to verify if there is something specific to the git directory that is different.
I'm not able to repro in more than one directory, containing worktrees for a specific repo, but the only difference I've found between difference worktrees is that the directory containing the worktrees that this is crashing in has multiple worktrees in it. The ones that aren't only have 1.
I don't think this should affect anything, though.
So I am having a hard time reproducing, but the one thing I have noticed as a difference between different repos is that one repo was created as a regular (non-bare) repository, I later created a worktree repo from this repo with a different name.
Note: I created these worktrees originally using this script:
#!/bin/bash# Define the base directory for the worktrees
WORKTREE_BASE_DIR="repo.worktrees"# Create the base directory if it doesn't exist
mkdir -p "$WORKTREE_BASE_DIR"# Get the list of all branches
branches=$(git branch -r | grep -v '\->'| sed 's/origin\///'| sort | uniq)# Loop through each branch and create a worktreeforbranchin$branches;do# Define the path for the worktree
worktree_path="$WORKTREE_BASE_DIR/$branch"# Check if the worktree already existsif [ -d"$worktree_path" ];thenecho"Worktree for branch '$branch' already exists at '$worktree_path'. Skipping..."else# Create the worktreeecho"Creating worktree for branch '$branch' at '$worktree_path'..."
git worktree add "$worktree_path""origin/$branch"fidoneecho"All worktrees have been created."%
I stumbled upon the same error but likely via a different path, which means it might not be the exactly the same as above.
For some unknown reason I got a repo into the state where .git/worktrees/.../gitdir points to the checkout I am in. Effectively resulting in a loop.
i.e /some/path/my_repo/.git/worktrees/.../gitdir has the value /some/path/my_repo/.git
Lazygit no longer crashes, thanks, but it still doesn't allow me to use Lazygit on the bare repository. If I am within a subdirectory within a different repository, it shows me the higher up directory's git information.
Roger all that, the crashes are resolved, thank you :)
I have my $HOME under git version control & I have $HOME/.gitignore with * and then manually allow !version-me for individual dotfiles for intentional-only tracking. Then $HOME/workspaces/group-namespace/project-name/non-bare-repo checkouts for my main workareas & $HOME/mirrors/group-namespace/project-name/bare-repo for mirroring key GitHub repositories with a crontab to keep them up to date locally.. It's just a setup I've had for 20+ years of development to keep key projects around -- many of us older devs have trust issues. ;-) It'd just be nice to cd into those bare checkouts once in a while and see a lazygit rendered git commit history with all my muscle memory keybindings, but tig project works on bare checkouts so I'm good I guess..
Thanks to all the Lazygit devs for a wonderful tool :)
Activity
mark2185 commentedon Oct 31, 2023
Can't reproduce on
v0.40.2, so just to confirm the steps needed:Is this correct?
mariuskimmina commentedon Nov 1, 2023
@mark2185 Interesting, it really doesn't reproduce on the lazygit repo. The repo where I run into this panic is private so I can't just share that. I'll try to find what causes this and create an example that reproduces.
mariuskimmina commentedon Nov 1, 2023
I did manage to catch the error now:
mark2185 commentedon Nov 1, 2023
Does the repo have symlinks? Does it crash if the worktree is in a dir outside of the bare clone?
jwhitley commentedon Dec 28, 2023
This may be related to a bare-repo crash in #3175, which is fixed in (currently open) PR #3183. If you're feeling ambitious, pull my branch in that PR and give it a whirl. Otherwise, retest after that PR lands and is released in hopefully not too long.
mariuskimmina commentedon Dec 28, 2023
I tried it with your PR branch but I still get this crash.
Also, the repo does not have symlinks but it does have additional repos cloned inside it.
If I try to use worktrees on the same repo but with a normal clone instead of a bare clone it seems to work fine.
jwhitley commentedon Jan 1, 2024
Thanks for the feedback on the PR. I just tried it with the PR branch, and I'm unable to repro. I used a workflow similar to the one above, but I don't place the worktree inside of the bare repo, but next to it (by using
env GIT_DIR=`realpath test` git worktree add main).Obviously there's a crash here, but at least the basic regular/bare repo plus worktree cases seem to work. I think there's something about the specific private repo that's probably triggering the crash. You mentioned that there are other repos cloned into the first one? Are these submodules, or some more unusual clone-inside-a-clone workflow?
If you're able to discover a repro workflow, perhaps using dummy repositories that mimic the cloning organization you mention, that would be a huge help.
jwhitley commentedon Feb 12, 2024
FYI, PR #3183 matured a bit, catching additional edge cases, and has been merged. If you have time, I'd love to know if your issue still reproduces on
master. It's plausible that your scenario did eventually get fixed.mariuskimmina commentedon Feb 14, 2024
I switched jobs and am no longer able to access the repo that caused this issue, so I can't ever say if this is fixed or not.
To answer your last question, it was a more unusual clone-inside-clone workflow but even if I removed the clones inside the crash still occured.
From my point of view I would be fine with closing this issue as I won't be able to tell if the issue is fixed or not.
Again thank you for the great work you are doing here, I love using lazygit.
voylin commentedon Aug 10, 2024
I'm having this issue right now. Just did a git clone --bare ... and git worktree add master. Without doing bare I was not having this issue at all in the repo.
jwhitley commentedon Aug 13, 2024
@voylin I’ll see if I can repro tomorrow, my time. What version of lazygit are you using?
jwhitley commentedon Aug 13, 2024
@voylin I'm still unable to repro, using lazygit v0.43.1. In samples above, this seemed to be repository dependent somehow. Is this happening for a public repository that you can share here? Alternatively, if you were able to create a public repo that reproduced the problem that would be a big help. Perhaps there's some unusual characteristic of your problem repo that's triggering the crash?
As it is, the underlying code had a major refactor and doesn't crash for similar workflows myself and others have tried in order to reproduce.
voylin commentedon Aug 13, 2024
Using Lazygit 0.43. I was using a public repo. I had this happen for https://github.com/VoylinsGamedevJourney/GoZen_lite. I don't know what went wrong, I don't rule out user error on my side though.
The steps I took were just a git clone bare of the repo, and adding the master branch with git worktree add. I got the problem fixed by just creating a folder with the repo name, using git clone but naming that folder master and in the same folder I added a worktree for the other branch. This works for me.
If you want I could try to replicate the issue and try to get some error logs or something to see if this is an actual issue or just me being dumb in setting up a git bare repo ^^"
jwhitley commentedon Aug 14, 2024
Thanks @voylin, that's helpful. Let me see if I've got this right:
git clone --bare https://github.com/VoylinsGamedevJourney/GoZen_lite bareenv GIT_DIR=$(realpath bare) git worktree add main– this adds the worktreemainalongside the repobare, i.e. both have the same parent directory.cd mainlazygitThat workflow isn't crashing for me on lazygit 0.43.1. If you're doing something different when you see the crash, it would be great to know what the exact steps are, since clearly some users hit roadblock here. (and even if the fix is "don't crash, and provide some usage guidance")
Last but not least, I also tried putting a worktree inside of the
barerepo directory (which is super weird, since it's the git data directory), but that didn't crash either.christopher-harwell commentedon Aug 16, 2024
I am getting this error as well, specifically with worktrees. I can provide repro steps and try recloning the directory to verify if there is something specific to the git directory that is different.
jwhitley commentedon Aug 16, 2024
@christopher-harwell That would be great if you can figure out repro steps. So far, no contributors have been able to repro this one.
christopher-harwell commentedon Aug 17, 2024
I'm not able to repro in more than one directory, containing worktrees for a specific repo, but the only difference I've found between difference worktrees is that the directory containing the worktrees that this is crashing in has multiple worktrees in it. The ones that aren't only have 1.
I don't think this should affect anything, though.
I can keep looking today.
christopher-harwell commentedon Aug 22, 2024
So I am having a hard time reproducing, but the one thing I have noticed as a difference between different repos is that one repo was created as a regular (non-bare) repository, I later created a worktree repo from this repo with a different name.
Note: I created these worktrees originally using this script:
I will update again if I find anything else
GertBurger commentedon Nov 25, 2024
I stumbled upon the same error but likely via a different path, which means it might not be the exactly the same as above.
For some unknown reason I got a repo into the state where
.git/worktrees/.../gitdirpoints to the checkout I am in. Effectively resulting in a loop.i.e
/some/path/my_repo/.git/worktrees/.../gitdirhas the value/some/path/my_repo/.gitIf this is a different issue then please ignore.
bobrenjc93 commentedon Feb 5, 2026
+1 hitting the same issue
stefanhaller commentedon Aug 8, 2026
Could those who can still repro this please check if it is fixed in current master? Thanks.
jessefarinacci commentedon Aug 10, 2026
Lazygit no longer crashes, thanks, but it still doesn't allow me to use Lazygit on the bare repository. If I am within a subdirectory within a different repository, it shows me the higher up directory's git information.
stefanhaller commentedon Aug 11, 2026
No, that's a known limitation, and very unlikely to change. See #4244.
I don't understand; you have a bare repo as a subdirectory of another, non-bare repo? Can you describe that use case more?
jessefarinacci commentedon Aug 11, 2026
Roger all that, the crashes are resolved, thank you :)
I have my
$HOMEunder git version control & I have$HOME/.gitignorewith*and then manually allow!version-mefor individual dotfiles for intentional-only tracking. Then$HOME/workspaces/group-namespace/project-name/non-bare-repocheckouts for my main workareas &$HOME/mirrors/group-namespace/project-name/bare-repofor mirroring key GitHub repositories with a crontab to keep them up to date locally.. It's just a setup I've had for 20+ years of development to keep key projects around -- many of us older devs have trust issues. ;-) It'd just be nice tocdinto those bare checkouts once in a while and see alazygitrendered git commit history with all my muscle memory keybindings, buttigproject works on bare checkouts so I'm good I guess..Thanks to all the Lazygit devs for a wonderful tool :)
stefanhaller commentedon Aug 11, 2026
Ah right, I missed that it was you who posted #4244. Thanks for explaining. Still unlikely to change, sorry. 😉