How to change token for github bridge?
I had used git-bug over a year ago and have already configured bridge. Running it now results in
(git)smaug:/mnt/btrfs/datasets/datalad-git-bug[master]git
$> strace -f -o /tmp/bridge-pull.strace git bug bridge pull
import error: non-200 OK status code: 401 Unauthorized body: "{\"message\":\"Bad credentials\",\"documentation_url\":\"https://docs.github.com/graphql\"}"
imported 0 issues and 0 identities with default bridge
since I failed to find how to change the token, I found in that strace that auth was saved into /home/yoh/.config/git-bug/keyring/auth-0c111SENSORED which I moved aside in hope that git bug would ask me for a token to store -- but nope:
$> git bug bridge pull
A lock file is present but the corresponding process is not, removing it.
Error: missing identity token
So I decided to ask on how could I provide a new/replacement token?
$> git bug version
git-bug version: 0.7.1-dev-b2e98ef07f
@yarikoptic I'm using version v0.8.0 so I'm not sure if it's gonna help 0.7.1
but if you do a git bug bridge auth you'll have the list of token
➜ xxx git:(feat/xxx) git bug bridge auth
shaone github token special_simple_token login:xxx
you can then do a git bug bridge auth rm shaone
and git bug bridge auth add-token --target github --login=yourlogin to add your newly generated token.
@MichaelMure I still think that finding 'documentation' insides the issues is a bad idea. It should be in the manpage at least imho I can do a pull request if you change your mind.
Thank you for the great work
Doc improvement is very very much welcome :-)
I'm using version v0.8.0 so I'm not sure if it's gonna help 0.7.1
indeed I had no output on my version. So I upgraded git-bug, tried it, was alerted to migrate, did migration
/home/yoh/proj/misc/git-bug-migration/git-bug-migration --for-real 297.43s user 148.24s system 89% cpu 8:18.22 total
but then got some odd error:
$> git-bug version
git-bug version: v0.8.0-dev-064d866ca5
$> git bug bridge auth
Building cache...
bug 0 / -1 [-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------] 0 %
identity 0 / -1 [-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------] 0 %
Error: cannot create new index, path already exists
$> echo $?
1
not clear which path it talks about, probably not related really to auth but rather something about git-bug since happens also for git-bug bug. search brought no hits. My guess - migration didn't go "well"?
Not sure what's happening, but you can try to delete .git/git-bug to force recreating the cache. It looks like you have a conflicting file?
eh, moved all previous 144MB aside and rerunning... it was hanging for awhile on
Building cache...
bug 2975 / 2975 [=================================================================================================>] 100 %
identity 142 / 142 [=================================================================================================>] 100 %
after 20 minutes it was done but provided no remedy -- auth returns nothing, pull'ing with new git-bug results in the same error:
$> git-bug bridge auth
$> git bug bridge pull
Error: missing identity token
$> git bug version
git-bug version: v0.8.0-dev-064d866ca5
Did you do what @guilbep suggested? https://github.com/MichaelMure/git-bug/issues/995#issuecomment-1400072210
after 20 minutes it was done
We need to track why it's so slow.
Did you do what @guilbep suggested? #995 (comment)
may be I am missing specific aspect, but that is exactly what I was trying to do - to get the "identity" of the auth by running git-bug bridge auth but as I shown - it gives no output.
after 20 minutes it was done
We need to track why it's so slow.
may be a sheer number of issues (>2k) could be a reason? I remember that I had to run initial pull for an extended amount of time to get them all. .git/git-bug is now 221MB.
Yes but you are rebuilding from local data. Did you notice it it stays long at 100%?
Yes but you are rebuilding from local data. Did you notice it it stays long at 100%?
yes, IIRC it was staying awhile after relatively quickly reaching 100%. I still have a tarball of not upgraded repository. I do not think it has any secrets in it. If you want, I can give it to you (100MB .tar.gz) to benchmark if so desired (may be my BTRFS file system got busy/slow at that point? unlikely though).
@yarikoptic https://github.com/MichaelMure/git-bug/pull/1011 should get you a faster cache rebuild. I'd be curious to see how it perform for you.
now that it is updated, my "priority" is the original issue/question -- how to change the token?
ping -- any ideas on how to change the token?
probably nevermind, I worked around:
- I established a bridge in another repo where git-bug also created a new token
- I copy/pasted
git-bug.identityentry between .git/config files andgit bug bridge pullworked out
Reopened because I think this is a valid user story - see https://github.com/MichaelMure/git-bug/issues/995#issuecomment-1411113570 for a work-around.
@smoyer64 @yarikoptic as I said above the following worked for me (in git-bug version 0.8.0) to update/change my token:
git bug bridge auth # to list the token
f1666cc github token ghp_IWONTTELLYOU login:MYUSERNAME
git bug bridge auth rm f1666cc # to remove the token
git bug bridge auth add-token --target github --login= MYUSERNAME # to add your newly generated token.
By the way. Maybe the problem is from somewhere else. I noticed that only Tokens (classic) are working and not Fined grained tokens. And that info is not in the documentation yet.
Nobody has cared to implement support for those new token. A good first step would be to know what changes need to happen: is it just a different validation regex? Do we need to do request differently?
Nobody has cared to implement support for those new token. A good first step would be to know what changes need to happen: is it just a different validation regex? Do we need to do request differently?
I tried find the piece of code responsible for this. But I could not find It where should I look ? https://github.com/MichaelMure/git-bug/blob/master/bridge/core/auth/credential_test.go ?
I believe everything is in https://github.com/MichaelMure/git-bug/blob/master/bridge/github/config.go.
Notably, you have the regex to validate a manually entered token: https://github.com/MichaelMure/git-bug/blob/master/bridge/github/config.go#L367
... and the process to generate a new token: https://github.com/MichaelMure/git-bug/blob/1ae31b342b57ace44131f5ecd03c506814a25e62/bridge/github/config.go#L183-L194
This bot triages untriaged issues and PRs according to the following rules:
- After 90 days of inactivity, the
lifecycle/stalelabel is applied - After 30 days of inactivity since
lifecycle/stalewas applied, the issue is closed
To remove the stale status, you can:
- Remove the
lifecycle/stalelabel - Comment on this issue