This guide assumes you're working on a Unix-like environment. I'm using Linux Mint (Ubuntu). It should work on Macs, and might on Windows.
These are the four steps you can use as a checklist, see the headings below for the details on each step.
- Enable forge support
- Create a Gitlab API key
- Add your gitlab credentials to
~/.authinfo.gpg
- Set-up forge in emacs
First, enable forge support in doom. Go to ~/.doom.d/init.el
, and replace the magit
module with (magit +forge)
.
For clarity, it should look somewhat like this
lsp
;;macos ; MacOS-specific commands
(magit +forge) ; a git porcelain for Emacs
;;make ; run make tasks from Emacs
;;pass ; password manager for nerds
You'll have to run doom sync
and restart emacs. In emacs, you can use M-x doom/reload
or <SPC h r r>
Create a Gitlab API key for the account you'll be using to access your repositories, write this one down. I'm not entirely sure what rights you should give the repo, but I gave it all read rights, and write rights to the repository itself.
Edit or create the file ~/.authinfo.gpg
. If it's new, paste the following. Fill in your email address, your gitlab username and your api key where the {{LOUD-BRACKETS}}
are.
# -*- epa-file-encrypt-to: ("{{YOUR-EMAIL-ADDRESS}}") -*-
machine gitlab.com/api/v4 login {{YOUR-GITLAB-USERNAME}}^forge password {{YOUR-API-KEY}}
NOTE THE NEWLINE AT THE END, the authinfo format is very sensitive.
In emacs, open a magit buffer for a or the repo you want to use forge with. Run the command M-x forge-add-repository
. Note, if you have a remote named origin
(as is the convention) in this repository, forge will automatically fill in the right info. If you don't, you'll have to type in the remote yourself. IE [email protected]:{{your-user}}/{{your-repo}}
In a Magit buffer, press @
(discover via the popup of popups with ?
). This will list all available forge commands. You can now list issues, create issues, and lots more, yay!
Am getting
Required Gitlab token ("HyperFocus^forge" for "gitlab.com/api/v4") does not exist
with an API key with all the permissions set, no idea how to debug as the official docs on the initial setup are quite sparse.The docs do mention the text below, which suggests only the api permission is needed.
Some more docs are available here and here, but have not been able to figure it out so far.