git不会检测到远程分支

发布于 2025-02-01 17:44:25 字数 480 浏览 1 评论 0原文

我已经克隆了一个存储库(如果相关,则来自gitlab) 我在本地计算机上得到了存储库,分支为 master

我想结帐到另一个分支 enter_target

i i可以 明显 em>请参阅该分支存在于遥控存储库中。 但是,当我这样做时,

git checkout another_target 

error: pathspec 'another_target' did not match any file(s) known to git   

只是要检查我

git branch -r

,不!分支另一个_target不会出现!

但是我可以在存储库中看到它!

为什么会发生这种情况?如何解决?

I have cloned a repository (from gitlab if relevant)
I got the repo in my local machine, the branch being master

I want to checkout to another branch another_target

I can clearly see that this branch exist in the remote repo.
However when I do

git checkout another_target 

I got

error: pathspec 'another_target' did not match any file(s) known to git   

Just to check I do

git branch -r

and no! the branch another_target does not appear!

But I can see it in the repo!

Why is this happening and how can I solve it?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

盗梦空间 2025-02-08 17:44:25

要更新远程分支,您应该首先运行,

git fetch

然后如果存在远程分支,则应使用Checkout

To update your remote branches you should first run

git fetch

then your checkout should work if the remote branch exists

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文