-
Notifications
You must be signed in to change notification settings - Fork 0
/
2021-12-08-magit_forge-and-self-hosted-gitlab.html
65 lines (57 loc) · 3.78 KB
/
2021-12-08-magit_forge-and-self-hosted-gitlab.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<link rel="alternate"
type="application/rss+xml"
href="https://magnus.therning.org/feed.xml"
title="RSS feed for https://magnus.therning.org/">
<title>Magit/forge and self-hosted GitLab</title>
<meta name="author" content="Magnus Therning"><meta name="referrer" content="no-referrer"><link href= "static/style.css" rel="stylesheet" type="text/css" /><link href= "static/htmlize.css" rel="stylesheet" type="text/css" /><link href= "static/extra_style.css" rel="stylesheet" type="text/css" /></head>
<body>
<div id="preamble" class="status"><div class="nav-bar"><a class="nav-link" href="./index.html">Top</a><a class="nav-link" href="./archive.html">Archive</a><a class="nav-link align-right" href="./feed.xml"><img src="static/rss-feed-icon.png" style="height: 24px;" /></a></div></div>
<div id="content">
<div class="post-date">08 Dec 2021</div><h1 class="post-title"><a href="https://magnus.therning.org/2021-12-08-magit_forge-and-self-hosted-gitlab.html">Magit/forge and self-hosted GitLab</a></h1>
<p>
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).
</p>
<p>
First put the following in `~/.gitconfig`
</p>
<div class="org-src-container">
<pre class="src src-gitconfig">[<span class="org-type">gitlab</span> <span class="org-function-name">"gitlab.private.com/api/v4"</span>]
<span class="org-variable-name">user</span> = my.username
</pre>
</div>
<p>
Then create an access token on GitLab. I ticked <code>api</code> and <code>write_repository</code>,
which seems to work fine so far. Put the token in <code>~/.authinfo.gpg</code>
</p>
<div class="org-src-container">
<pre class="src src-authinfo"><span class="org-variable-name">machine</span> <span class="org-builtin">gitlab.private.com/api/v4</span> <span class="org-comment-delimiter">login</span> <span class="org-keyword">my.user^forge</span> <span class="org-comment-delimiter">password</span> <span class="org-doc"><token></span>
</pre>
</div>
<p>
(Remember that a newline is needed at the end of the file.)
</p>
<p>
Finally, add the GitLab instance to <code>'forge-alist</code>
</p>
<div class="org-src-container">
<pre class="src src-emacs-lisp"><span class="org-rainbow-delimiters-depth-1">(</span><span class="org-keyword">setq</span>
forge-alist
'<span class="org-rainbow-delimiters-depth-2">(</span><span class="org-rainbow-delimiters-depth-3">(</span><span class="org-string">"gitlab.private.com"</span> <span class="org-string">"gitlab.private.com/api/v4"</span> <span class="org-string">"gitlab.private.com"</span> forge-gitlab-repository<span class="org-rainbow-delimiters-depth-3">)</span>
<span class="org-rainbow-delimiters-depth-3">(</span><span class="org-string">"github.com"</span> <span class="org-string">"api.github.com"</span> <span class="org-string">"github.com"</span> forge-github-repository<span class="org-rainbow-delimiters-depth-3">)</span>
<span class="org-rainbow-delimiters-depth-3">(</span><span class="org-string">"gitlab.com"</span> <span class="org-string">"gitlab.com/api/v4"</span> <span class="org-string">"gitlab.com"</span> forge-gitlab-repository<span class="org-rainbow-delimiters-depth-3">)</span><span class="org-rainbow-delimiters-depth-2">)</span>
<span class="org-rainbow-delimiters-depth-1">)</span>
</pre>
</div>
<p>
That's it!
</p>
<div class="taglist"><a href="https://magnus.therning.org/tags.html">Tags</a>: <a href="https://magnus.therning.org/tag-emacs.html">emacs</a> <a href="https://magnus.therning.org/tag-git.html">git</a> <a href="https://magnus.therning.org/tag-magit.html">magit</a> </div></div>
<div id="postamble" class="status"><!-- org-static-blog-page-postamble --></div>
</body>
</html>