Need help running "go get" on self hosted git server

152 views
Skip to first unread message

Brijesh Wawdhane

unread,
Dec 18, 2023, 8:19:14 AM12/18/23
to golang-nuts
I added a go-import meta tag to my git server's website on the repo page and it looks like

<meta name="go-import" content="brijesh.dev/kairos git https://brijesh.dev/kairos.git">

but when I try running "go get brijesh.dev/kairos" I get an error saying 'go: unrecognized import path "brijesh.dev/kairos": reading https://brijesh.dev/kairos?go-get=1: 404 Not Found'

it is probably because it is looking at https://brijesh.dev/kairos?go-get=1(which is invalid) and not https://brijesh.dev/kairos.git?go-get=1(the correct address) even though it the url is with .git in the go-import tag

Jan Mercl

unread,
Dec 18, 2023, 9:01:50 AM12/18/23
to Brijesh Wawdhane, golang-nuts
I'm not sure what is correct, but FTR this redirector service reports the redirected URL without the .git suffix and it works as intended:

----
jnml@3900x:~/tmp$ wget modernc.org/sqlite
--2023-12-18 14:57:40--  http://modernc.org/sqlite
Resolving modernc.org (modernc.org)... 216.239.34.21, 216.239.32.21, 216.239.38.21, ...
Connecting to modernc.org (modernc.org)|216.239.34.21|:80... connected.
HTTP request sent, awaiting response... 302 Found
Location: https://modernc.org/sqlite [following]
--2023-12-18 14:57:40--  https://modernc.org/sqlite
Connecting to modernc.org (modernc.org)|216.239.34.21|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 577 [text/html]
Saving to: 'sqlite'

sqlite                                            100%[=============================================================================================================>]     577  --.-KB/s    in 0s      

2023-12-18 14:57:41 (20.6 MB/s) - 'sqlite' saved [577/577]

jnml@3900x:~/tmp$ cat sqlite
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<meta name="go-import" content="modernc.org/sqlite git https://gitlab.com/cznic/sqlite">
<meta name="go-source" content="modernc.org/sqlite _ https://gitlab.com/cznic/sqlite/blob/master{/dir} https://gitlab.com/cznic/sqlite/blob/master{/dir}/{file}#L{line}">
<meta http-equiv="refresh" content="0; url=https://godoc.org/modernc.org/sqlite">
</head>
<body>
Redirecting to docs at <a href="https://godoc.org/modernc.org/sqlite">godoc.org/modernc.org/sqlite</a>...
</body>
</html>
jnml@3900x:~/tmp$

----

Dan Kortschak

unread,
Dec 18, 2023, 2:32:50 PM12/18/23
to golan...@googlegroups.com
If you go to the page for the repo[1] with a browser and attempt to
follow the link for the commit[2], it gives a 404, so the server seems
sick.

[1]https://brijesh.dev/kairos.git
[2]https://brijesh.dev/kairos/commit/fa700f82d14a5a319cb6267a7dbde994683067ca

Brijesh Wawdhane

unread,
Dec 28, 2023, 10:30:16 AM12/28/23
to golang-nuts
I was able to make it work
(and no the server is healthy)

I am using legit (https://github.com/icyphox/legit) for my git frontend, it is like cgit or stagit if you've those before. The default route for repo page in legit is domain.extension/repository.git, but because running legit is basically cloning it and running 'go build' I changed the code slightly to check if there is no .git at end of url then instead of returning 404 it should show code for webpage with the .git extension added.

This wouldn't be an issue if I was creating bare git repositories on server without the .git in its name, but I switched from using gitolite to soft-serve to handle users on the server.
Reply all
Reply to author
Forward
0 new messages