Simon Schuster (noctux) opened
It does not seem to be possible to have two bridges using a common token with the same target:
The following was performed within a clean environment:
- Initial clone of one repository (I've edited out my token), everything works as expected:
[eve@computer test]$ git clone https://github.com/MichaelMure/git-bug
Cloning into 'git-bug'...
remote: Enumerating objects: 85, done.
remote: Counting objects: 100% (85/85), done.
remote: Compressing objects: 100% (64/64), done.
remote: Total 11128 (delta 35), reused 41 (delta 20), pack-reused 11043
Receiving objects: 100% (11128/11128), 15.75 MiB | 13.19 MiB/s, done.
Resolving deltas: 100% (6415/6415), done.
[eve@computer test]$ cd git-bug
[eve@computer git-bug]$ git bug user create
Building identity cache... Done.
Building bug cache... Done.
Error: Error running git command: config user.name
[eve@computer git-bug]$ git config user.name "eve"
[eve@computer git-bug]$ git config user.email "eve@example.org"
[eve@computer git-bug]$ git bug user create
Name [eve]:
Email [eve@example.org]:
Avatar URL:
a66bcfdac7e2687ddb9310fc27bd011a5b8e334d
[eve@computer git-bug]$ git bug bridge configure --name=github --target=github --token=$MYTOKEN --url=https://github.com/MichaelMure/git-bug
Successfully configured bridge: github
[eve@computer git-bug]$ git bug bridge pull github
new identity: 85871c63bc6b96359ec6ab4db876bba950ddd2a8
...
changed status: 1ee55b4f149e87fbc80d1ddefb43666e33f12381748044dd8c195d305d12b9b5
imported 120 issues and 81 identities with github bridge
- Clone of another repository
[eve@computer test]$ git clone https://github.com/MichaelMure/go-term-text
Cloning into 'go-term-text'...
remote: Enumerating objects: 263, done.
remote: Counting objects: 100% (263/263), done.
remote: Compressing objects: 100% (158/158), done.
remote: Total 263 (delta 141), reused 216 (delta 100), pack-reused 0
Receiving objects: 100% (263/263), 132.13 KiB | 782.00 KiB/s, done.
Resolving deltas: 100% (141/141), done.
[eve@computer test]$ cd go-term-text/
[eve@computer go-term-text]$ git config user.name "eve"
[eve@computer go-term-text]$ git config user.email "eve@example.org"
[eve@computer go-term-text]$ git bug bridge configure --name=github2 --target=github --token=$TOKEN --url=https://github.com/MichaelMure/go-term-text
Building identity cache... Done.
Building bug cache... Done.
Successfully configured bridge: github2
[eve@computer go-term-text]$ git bug bridge pull github2
Error: missing identity token
[eve@computer go-term-text]$ git bug user create
Name [eve]:
Email [eve@example.org]:
Avatar URL:
605b22282a8abb56095422679affa4bf7872a98e
[eve@computer go-term-text]$ git bug bridge pull github2
Error: missing identity token
The same issue also happens when running git bug bridge auth afterwards:
Repo from 1):
[eve@computer git-bug]$ git bug bridge auth
51e8d3f github token eve $TOKEN
Repo from 2):
[eve@computer go-term-text]$ git bug bridge auth
Error: identity doesn't exist
My guess is that this is related to the credentials stored in the global .gitconfig file. After both bridges have been configured, there is only a single auth block (ids shortended as I don't know whether they leak information):
[git-bug "auth.51e8d..."]
kind = token
userid = a66bcfdac7e2687ddb9310fc27bd011a5b8e334d
target = github
createtime = 1578397411
value = $TOKEN
As you can see, it maps to the userid of the user created in 1). If I edit userid to the userid from step 2 (so 605b22282a8abb56095422679affa4bf7872a98e) I can query auth (git bug bridge auth) pull (git bug bridge pull githubX) in the repo from 2), but not anymore in the one from 1).
Generally, it would be nice to have a general bridge configuration that is usable from all my repositories and not bound to an individual (repository-local) identity. So I'd rather have a bridge "github" with token from my account that I can use with all my repositories on github. If multiaccount-usage is required, the user could then create an "github-account2" bridge...
Thank you for this software and reading thus far in this bug report :) I hope this information is more-or-less complete and sufficient, but feel free to ping me if you need more information/a tester.
Best regards, Simon
Useful information:
- git-bug version 0.6.0.r3.gca1d305-1, revision ca1d305308d4ee6d0fec16a0af10b62bb52cd265 build from git
- go version go1.13.5 linux/amd64
- git version 2.24.1