git fetch 总是失败

问题描述 投票:0回答:2

我在 TFS 女士上创建了一个分支,并尝试使用代码将其拉到我的本地计算机上:

git fetch

这是获取的结果:

error: cannot update the ref 'refs/remotes/origin/tryYourself/192RestService': unable to create directory for '.git/logs/refs/remotes/origin/tryYourself/192RestService': No such file or directory
From "url"
 ! [new branch]      tryYourself/192RestService -> origin/tryYourself/192RestService  (unable to update local ref)

然后我在 Google 和 StackOverflow 上搜索了它,他们告诉我这样做:

git gc --prune=now

还有:

git remote prune origin

然后我又做了:

git fetch 

所以我可以在该分支上工作,但它会返回如上所述的结果/错误。

有人有建议吗?

git tfs cmd branch
2个回答
0
投票
  1. 确保运行
    git fetch
    的用户具有写入权限 您的本地存储库。
  2. 请检查下是否有名为“192RestService”的文件
    refs/remotes/origin/tryYourself/
  3. 尝试删除文件“192RestService”,然后再次检查
    gitfetch

0
投票

如果

git fetch
git fetch --all
不起作用

,请尝试以下步骤

步骤:

  1. 在项目目录下运行
    vi .git/config
    命令。
  2. 搜索这行代码

[远程“原点”]

  1. 在[远程“origin”]下提及此代码并保存

fetch = +refs/heads/:refs/remotes/origin/

您的最终代码将如下所示:

[remote "origin"]
    url = [email protected]:fadiahac/seo-manager.git
    fetch = +refs/heads/*:refs/remotes/origin/*

完成!! ✅👍

© www.soinside.com 2019 - 2024. All rights reserved.