Search code examples
gogitlabgoland

go get remote: The project you were looking for could not be found or you don't have permission to view it


I am using go 1.20.1 , Windows 10 x64, GoLand 2022.3.2 .

Go to ... , create file .netrc with content

machine gitlab.com login my_username password my_password

Set environment variable

enter image description here

then get dependency

go get gitlab.com/foo/bar/baa/fuu

Error

remote: The project you were looking for could not be found or you don't have permission to view it.

How to fix it?


Solution

  • First, make sure to use a PAT (Personal Access Token), not your actual GitLab account password, in %USERPROFILE%\_netrc.

    Second use go get gitlab.com/foo/bar, not foo/bar/baa/fu.
    As in go get gitlab.com/name_or_group/repo_name.