Bridge to GitLab: "wrong token scope ou non-existent project"

Timeline

Iain Samuel McLean Elder (iainelder) opened

How do I set up a bridge to a private GitLab project?

I've tried this and to get an error:

cat /tmp/token |
git bug bridge configure \
    --name gitlab \
    --target gitlab \
    --url https://gitlab.com/private/project/ \
    --base-url https://gitlab.com/ \
    --login privateuser \
    --token-stdin \
    --non-interactive
Error: project validation: wrong token scope ou non-existent project: GET https://gitlab.com/api/v4/projects/private/project/: 404 {message: 404 Project Not Found}

I've tried with a token in the api scope and a token in all scopes.

git-bug version reports v0.8.0. Installed from master branch revision https://github.com/git-bug/git-bug/commit/d499b6e9d3333334614924669b74640a2d0b5485

The doc says to use command git bug bridge new which doesn't exist here.

$ git bug bridge new
Error: unknown command "new" for "git-bug bridge"

ldbds (ldbds) commented

You can configure bridge interactively with command git bug bridge configure:

git bug bridge configure

or add url to your specific git repo YOUR_PROJECT

cat /tmp/token |
git bug bridge configure \
    --name gitlab \
    --target gitlab \
    --url https://gitlab.com/private/project/YOUR_PROJECT \
    --base-url https://gitlab.com/ \
    --login privateuser \
    --token-stdin \
    --non-interactive

I was also struggling with 404. And it turn out to be something with proxy: Gitlab api v4 returns 404

The error looks like

$ git bug bridge configure
[1]: github
[2]: gitlab
[3]: jira
[4]: launchpad-preview
target: 2
name [default]: test
Gitlab server URL [https://gitlab.com/]: https://hamster.amecnsh.com/

Detected projects:
[1]: https://hamster.amecnsh.com//jeffli/cplc_recipe_bug_tracker

[0]: Another project

Select option: 1
Gitlab login: jeffli

[1]: enter my token

Existing token for gitlab:
[2]: 71fb270 => (base-url:https://hamster.amecnsh.com/,login:jeffli) (20 Feb 25
20:02 CST)

Select option: 2

Error: project validation: wrong token scope ou non-existent project: GET https:
//hamster.amecnsh.com/api/v4/projects//jeffli/cplc_recipe_bug_tracker: 404 {mess
age: 404 Project Not Found}

I finally bridge to my gitlab with the project ID :

$ git bug bridge configure
[1]: github
[2]: gitlab
[3]: jira
[4]: launchpad-preview
target: 2
name [default]: origin
Gitlab server URL [https://gitlab.com/]: https://hamster.amecnsh.com/

Detected projects:
[1]: https://hamster.amecnsh.com//jeffli/cplc_recipe_bug_tracker

[0]: Another project

Select option: 0
Gitlab project URL: https://hamster.amecnsh.com/72
Gitlab login: jeffli
You can generate a new token by visiting https://hamster.amecnsh.com/-/profile/p
ersonal_access_tokens.
Choose 'Create personal access token' and set the necessary access scope for you
r repository.

'api' access scope: to be able to make api calls

Enter token: xxxxx-XXXXXXXXXXXXXXXX
Current identity 0045923 tagged with login jeffli
Successfully configured bridge: origin

Iain Samuel McLean Elder (iainelder) commented (edited)

I tried again with the project URL (not the ID as you suggested) and this time it worked.

Current identity e601f0b tagged with login privateuser
Successfully configured bridge: gitlab

I don't know what I did wrong.

Thanks for the support @ldbds !

Iain Samuel McLean Elder (iainelder) closed the bug