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
{{ message }}
Repository navigation
"git bug push" fails with "Error: repository not found" when using insteadOf #944
If I configure a repository with a remote using that alias, as in:
git remote set-url origin me:git-bug-example
Then when I attempt to git bug push with this configuration, it fails with an error:
$ git bug push
Error: repository not found
It looks like git bug is performing git operations with something that doesn't parse git configuration files. Aliases like this can be expanded using the git remote get-url command:
Stepping through things with dlv debug, it looks like go-git isn't reading the global configuration: if I move the url configuration into .git/config, it seems to work as expected. That is, with the url configuration only in the global config, c.URLS is empty when we get to https://github.com/go-git/go-git/blob/master/config/config.go#L338; if I put the url configuration into .git/config, that variable gets populated as expected and insteadOf aliases are expanded.
The weird thing is that running git-bug under strace I can see that it's clearly reading the global configuration, so not entirely clear what's going on here.
This is probably a go-git issue, but to verify that I'll have to create a reproducer.
Those are two very different code path, as git-bug is reading the local+global config on its own. On the other hand when push/pull is done, it's pure go-git. It does look like a go-git bug.
it looks like go-git isn't reading the global configuration: if I move the url configuration into .git/config, it seems to work as expected
i know it's been a while, but thanks for running the debugger. having used go-git in some other projects, i can confirm indeed that they do not parse the url.<base>.insteadOf configuration (or even, last i checked, configuration via includeIf or other mechanisms).
support for this was (supposedly) added in go-git/[email protected], but it doesn't seem to actually work, with the url.<base>.insteadOf configuration in either the global or local scope, for example, using the following configuration:
this is still an issue at HEAD (3141185). it looks like we'll need to manually account for this using the default configuration chain (local > global > system, following any includes). i've accepted this bug and have slotted it in for the 0.8.2 release.
I got this problem with a repository URL containing ~ to refer to the home directory. Using an absolute path fixed it.
are you able to share your url.<base>.insteadOf config(s) for the remote you specified, and remote.<name>.url configuration for the repository? please be sure to redact anything you wish, such as paths on your local filesystem or details from the remote configuration that you don't want to share.
Activity
MichaelMure commentedon Dec 8, 2022
It's likely another shortcoming of go-git, although it seems that support for that has been added? go-git/go-git#79
Unfortunately, it's unlikely I can do anything about it. Maybe try to see if go-git (the minimal command they have) is able to understand your config?
larsks commentedon Dec 9, 2022
Stepping through things with
dlv debug, it looks likego-gitisn't reading the global configuration: if I move theurlconfiguration into.git/config, it seems to work as expected. That is, with theurlconfiguration only in the global config,c.URLSis empty when we get to https://github.com/go-git/go-git/blob/master/config/config.go#L338; if I put theurlconfiguration into.git/config, that variable gets populated as expected andinsteadOfaliases are expanded.The weird thing is that running
git-bugunderstraceI can see that it's clearly reading the global configuration, so not entirely clear what's going on here.This is probably a
go-gitissue, but to verify that I'll have to create a reproducer.MichaelMure commentedon Dec 9, 2022
Those are two very different code path, as git-bug is reading the local+global config on its own. On the other hand when push/pull is done, it's pure go-git. It does look like a go-git bug.
github-actions commentedon Jul 23, 2024
This bot triages untriaged issues and PRs according to the following rules:
lifecycle/stalelabel is appliedlifecycle/stalewas applied, the issue is closedTo remove the stale status, you can:
lifecycle/stalelabelmiwig commentedon Aug 6, 2024
I got this problem with a repository URL containing ~ to refer to the home directory. Using an absolute path fixed it.
sudoforge commentedon Aug 7, 2024
@larsks said earlier:
i know it's been a while, but thanks for running the debugger. having used
go-gitin some other projects, i can confirm indeed that they do not parse theurl.<base>.insteadOfconfiguration (or even, last i checked, configuration viaincludeIfor other mechanisms).support for this was (supposedly) added in go-git/[email protected], but it doesn't seem to actually work, with the
url.<base>.insteadOfconfiguration in either the global or local scope, for example, using the following configuration:this is still an issue at
HEAD(3141185). it looks like we'll need to manually account for this using the default configuration chain (local > global > system, following any includes). i've accepted this bug and have slotted it in for the 0.8.2 release.@miwig said earlier:
are you able to share your
url.<base>.insteadOfconfig(s) for the remote you specified, andremote.<name>.urlconfiguration for the repository? please be sure to redact anything you wish, such as paths on your local filesystem or details from the remote configuration that you don't want to share.fix: use the git cli to resolve remote URIs
fix: resolve the remote URI using url.*.insteadOf
fix: resolve the remote URI using url.*.insteadOf
fix: resolve the remote URI using url.*.insteadOf
fix: resolve the remote URI using url.*.insteadOf (git-bug#1394)