【发布时间】:2023-03-21 18:55:01
【问题描述】:
我有一个链接到旧远程仓库的本地仓库。我在 GitHub 上新建了一个 repo 并在文件夹中运行了它
git remote set-url origin <new repo url>
url 是新的 repo。然后我跑了
git push -u origin master
这将所有内容都推送到了我的新仓库。如果我运行
git remote -v
我得到了正确的回购位置。但是 vscode 似乎无法识别 repo。这是说当前打开的文件夹没有 git repo。为什么是这样?我尝试运行 git init 打印
Reinitialized existing Git repository in <folder name/.git/>
但这没有任何作用?
我该怎么做才能让 vscode 的源代码管理再次看到我的 repo?我有未提交的代码,所以不是所有内容都被推送,所以我不能简单地克隆 repo。
编辑:
当我尝试提交时,我收到以下错误
$ git commit -a -m "Renamed the repo"
fatal: this operation must be run in a work tree
【问题讨论】:
标签: git github visual-studio-code