[go: up one dir, main page]

Skip to content

Help: Private gitlab dependencies are getting project?go-get=1 404 errors when I try to get them in golang

Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.

I have a project that needs to rely on the private project of private gitlab repository.

I configured it through the following command, but a URL 404 error occurred. The example is as follows

$ go env -w GOPRIVATE=gitlab.mycompany.com
$ go env -w GOINSECURE=gitlab.mycompany.com
$ go env -w GONOPROXY=gitlab.mycompany.com
$ go get -v -x gitlab.mycompany.com/testgroup/compkg
# get https://gitlab.mycompany.com/?go-get=1
# get https://gitlab.mycompany.com/testgroup/testpkg?go-get=1
# get https://gitlab.mycompany.com/testgroup?go-get=1
# get https://gitlab.mycompany.com/testgroup?go-get=1: 404 Not Found (0.044s)
# get https://gitlab.mycompany.com/?go-get=1: 403 Forbidden (0.044s)
# get https://gitlab.mycompany.com/testgroup/testpkg?go-get=1: 404 Not Found (0.044s)
# get https://gitlab.mycompany.com/testgroup/testpkg?go-get=1
# get https://gitlab.mycompany.com/testgroup?go-get=1
# get https://gitlab.mycompany.com/?go-get=1
# get https://gitlab.mycompany.com/testgroup/testpkg?go-get=1: 404 Not Found (0.001s)
# get https://gitlab.mycompany.com/testgroup?go-get=1: 404 Not Found (0.001s)
# get https://gitlab.mycompany.com/?go-get=1: 403 Forbidden (0.002s)
go get: unrecognized import path "gitlab.mycompany.com/testgroup/testpkg": reading https://gitlab.mycompany.com/testgroup/testpkg?go-get=1: 404 Not Found

Then I tried to switch to ssh to pull, the example is as follows

$ git config --global url."git@gitlab.mycompany.com:testgroup/compkg.git".insteadOf "https://gitlab.mycompany.com/testgroup/compkg"
$ go get -v -x gitlab.mycompany.com/testgroup/compkg
# get https://gitlab.mycompany.com/?go-get=1
# get https://gitlab.mycompany.com/testgroup/testpkg?go-get=1
# get https://gitlab.mycompany.com/testgroup?go-get=1
# get https://gitlab.mycompany.com/testgroup?go-get=1: 404 Not Found (0.044s)
# get https://gitlab.mycompany.com/?go-get=1: 403 Forbidden (0.044s)
# get https://gitlab.mycompany.com/testgroup/testpkg?go-get=1: 404 Not Found (0.044s)
# get https://gitlab.mycompany.com/testgroup/testpkg?go-get=1
# get https://gitlab.mycompany.com/testgroup?go-get=1
# get https://gitlab.mycompany.com/?go-get=1
# get https://gitlab.mycompany.com/testgroup/testpkg?go-get=1: 404 Not Found (0.001s)
# get https://gitlab.mycompany.com/testgroup?go-get=1: 404 Not Found (0.001s)
# get https://gitlab.mycompany.com/?go-get=1: 403 Forbidden (0.002s)
go get: unrecognized import path "gitlab.mycompany.com/testgroup/testpkg": reading https://gitlab.mycompany.com/testgroup/testpkg?go-get=1: 404 Not Found

Same error on both attempts. go get: unrecognize import path "gitlab.mycompany.com/testgroup/compkg": reading https://gitlab.mycompany.com/testgroup/compkg?go-get=1: 404 Not Found

I used the following curl command to return the following error:

$ curl --insecure https://gitlab.mycompany.com/testgroup/compkg?go-get=1
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html>
<head><title>404 Not Found</title></head>
<body bgcolor="white">
<h1>404 Not Found</h1>
<p>The requested URL was not found on this server.<hr/>Powered by Tengine</body>
</html

Is there any other way to try, or is it my trial and error? Looking forward to your reply.

PS: gitlab.mycompany.com/test/compkg does not have any git tag And testgroup is groupname not username of gitlab.

  • gitlab version: Gitlab Community Edition 13.6.7
  • go version: go v1.16 AND v1.20
  • I can git pull project by enter username and password
Edited by 🤖 GitLab Bot 🤖