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

"git bug push" fails with "Error: repository not found" when using insteadOf #944

Open
larsks opened this issue Dec 7, 2022 · 3 comments
Labels
bug Something isn't working dependencies Pull requests that update a dependency file go-git

Comments

@larsks
Copy link

larsks commented Dec 7, 2022

I have insteadOf aliases in my git configuration, like this:

$ git config --list | grep me:
url.ssh://git@github.com/larsks/.insteadof=me:

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:

$ git remote get-url origin
ssh://git@github.com/larsks/git-bug-example
@MichaelMure MichaelMure added dependencies Pull requests that update a dependency file go-git bug Something isn't working labels Dec 8, 2022
@MichaelMure
Copy link
Owner

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
Copy link
Author

larsks commented Dec 9, 2022

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.

@MichaelMure
Copy link
Owner

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working dependencies Pull requests that update a dependency file go-git
Projects
None yet
Development

No branches or pull requests

2 participants