Posts tagged "git":
08 Dec 2021
Magit/forge and self-hosted GitLab
As I found the documentation for adding a self-hosted instance of GitLab to to magit/forge a bit difficult, I thought I'd write a note for my future self (and anyone else who might find it useful).
First put the following in `~/.gitconfig`
[gitlab "gitlab.private.com/api/v4"] user = my.username
Then create an access token on GitLab. I ticked api
and write_repository
,
which seems to work fine so far. Put the token in ~/.authinfo.gpg
machine gitlab.private.com/api/v4 login my.user^forge password <token>
(Remember that a newline is needed at the end of the file.)
Finally, add the GitLab instance to 'forge-alist
(setq forge-alist '(("gitlab.private.com" "gitlab.private.com/api/v4" "gitlab.private.com" forge-gitlab-repository) ("github.com" "api.github.com" "github.com" forge-github-repository) ("gitlab.com" "gitlab.com/api/v4" "gitlab.com" forge-gitlab-repository)) )
That's it!