获取远程资源:无法找到您要查找的项目,或者您没有权限查看它。

huangapple go评论77阅读模式
英文:

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

问题

我正在使用go 1.20.1,Windows 10 x64和GoLand 2022.3.2。

前往...,创建名为.netrc的文件,并添加以下内容:

machine gitlab.com login my_username password my_password

设置环境变量

获取远程资源:无法找到您要查找的项目,或者您没有权限查看它。

然后获取依赖项

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

错误信息

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

获取远程资源:无法找到您要查找的项目,或者您没有权限查看它。

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?

答案1

得分: 4

首先,请确保在 %USERPROFILE%\_netrc 文件中使用 PAT(个人访问令牌),而不是你的实际 GitLab 账户密码。

其次,请使用 go get gitlab.com/foo/bar,而不是 foo/bar/baa/fu
例如 go get gitlab.com/name_or_group/repo_name

英文:

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.

答案2

得分: 1

在Windows操作系统上,.netrc文件应该改为_netrc(下划线字符),而且不使用密码,而是使用GitLab访问令牌。

英文:

on Windows OS, it is not .netrc , it is _netrc (underscore character) , and not use password, use GitLab access token.

huangapple
  • 本文由 发表于 2023年2月20日 15:00:40
  • 转载请务必保留本文链接:https://go.coder-hub.com/75506133.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定