go get:当前分支没有跟踪信息。

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

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上):

  1. 找到go文件夹(对我来说它位于主目录中)并进入其中

    cd go

  2. 列出go文件夹的内容

    ls

  3. 你应该看到src文件夹,现在删除它:

    rm -rf src

  4. 再次尝试go get命令(针对你的包)

    go get -u github.com/ndelphit/apkurlgrep

  5. 你不应该再收到错误信息,运行你已安装的包(在我的情况下是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):

  1. Find the go folder (for me it is located in the home directory) and cd into it

    cd go

  2. List the contents of the go folder

    ls

  3. You should see the src folder, now delete it:

    rm -rf src

  4. Try the go get command again (for your package)

    go get -u github.com/ndelphit/apkurlgrep

  5. 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!

huangapple
  • 本文由 发表于 2022年3月11日 05:15:44
  • 转载请务必保留本文链接:https://go.coder-hub.com/71430900.html
匿名

发表评论

匿名网友

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

确定