【问题标题】:Git remote disappearance and inconsistencyGit远程消失和不一致
【发布时间】:2020-10-08 12:35:13
【问题描述】:
  • 我将文件复制到本地 .git/config,以更新项目的本地用户配置。
  • 之后,所有遥控器“消失”(有点)
  • git remote 为空,任何远程跟踪信息也是如此。
  • 本地 .git/refs/remotes 显示旧遥控器,git branch --remote 也是如此

如何恢复repo的状态?

【问题讨论】:

  • 所以你的意思是你丢失了原始配置?如果是这种情况,据我所知,Git 中没有配置文件的恢复机制。

标签: git


【解决方案1】:

.git/config 文件仅在本地,Git 不跟踪。

如果您记得这些遥控器的 URL,则需要手动添加它们:

git remote add origin /url/remote/repo
git remote add upstream(or any other remote name) /url/upstream/repo
...

【讨论】:

  • 明白。谢谢。
猜你喜欢
  • 2021-07-23
  • 2021-08-02
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2011-05-14
  • 1970-01-01
  • 2021-11-04
  • 1970-01-01
相关资源
最近更新 更多