英文:
go get : There is no tracking information for the current branch
问题
当我输入命令go get -u github.com/ndelphit/apkurlgrep
时,我收到以下错误信息:
> 当前分支没有跟踪信息。请指定您要与之合并的分支。有关详细信息,请参阅git-pull(1)。
>
> git pull <remote> <branch>
>
> 如果您希望为此分支设置跟踪信息,可以使用以下命令:
>
> git branch --set-upstream-to=origin/<branch> master
>
> 包github.com/ndelphit/apkurlgrep: 退出状态1
英文:
When I type in the command go get -u github.com/ndelphit/apkurlgrep
I get the error
> There is no tracking information for the current branch. Please
> specify which branch you want to merge with. See git-pull(1) for
> details
>
> git pull <remote> <branch>
>
> If you wish to set tracking information for this branch you can do so
> with:
>
> git branch --set-upstream-to=origin/<branch> master
>
> package github.com/ndelphit/apkurlgrep: exit status 1
答案1
得分: 2
这取决于你本地的 Go 版本以及你是在一个 Go 项目(带有 go.mod
文件)中执行该命令,还是在任何项目之外执行。
在项目内部,尝试执行 go clean -modcache
命令,然后执行以下命令:
go get github.com/ndelphit/apkurlgrep
英文:
It depends on your local Go version and if you are doing the command from a go project (with its go.mod
), or outside any project.
Inside a project, try a go clean -modcache
, and your
go get github.com/ndelphit/apkurlgrep
答案2
得分: 1
经过一番搜索,我找到了一个类似的问题这里。其中一个建议是从go目录中删除src文件夹,这对我起作用了。
所以这是我所做的(在Linux上):
-
找到go文件夹(对我来说它位于主目录中)并进入其中
cd go
-
列出go文件夹的内容
ls
-
你应该看到src文件夹,现在删除它:
rm -rf src
-
再次尝试go get命令(针对你的包)
go get -u github.com/ndelphit/apkurlgrep
-
你不应该再收到错误信息,运行你已安装的包(在我的情况下是apkurlgrep)以查看是否已安装。它可以运行!
英文:
After a little bit of digging, I found a similar issue here. One suggestion was to delete src from the go directory and this worked for me.
So here is what I did (Linux):
-
Find the go folder (for me it is located in the home directory) and cd into it
cd go
-
List the contents of the go folder
ls
-
You should see the src folder, now delete it:
rm -rf src
-
Try the go get command again (for your package)
go get -u github.com/ndelphit/apkurlgrep
-
You shouldn't get the error, run the package that you have installed (in my case apkurlgrep) to see if it has been installed. It runs!
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论