【问题标题】:Vscode source control doesn't recognize my repoVscode 源代码管理无法识别我的仓库
【发布时间】: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


    【解决方案1】:

    我必须进入我的 .git/config 并将工作树字段更新到新文件夹位置。

    【讨论】:

    • 我只是关闭并打开 Vs 代码并重新开始工作,但它只是将一些文件设置为未跟踪,我不知道为什么。
    猜你喜欢
    • 1970-01-01
    • 2012-06-02
    • 1970-01-01
    • 2017-12-20
    • 2022-06-27
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多