Github 中的远程回购名称已更改,但未反映在 Git 获取的本地回购中

Remote Repo name changed in Github, but not reflecting in Local Repo with Git fetch

尝试了以下命令

git remote set-url origin <new_url_after_repo_change>
git fetch --all
git reset --hard origin/master

使用以下命令验证了新的 URL。

git remote -v

远程 URL 已更新。但是 repo 的根文件夹名称没有改变

Just to answer my own question, which I posted 2 years back, there is no relation between git local repo root folder name and git remote repo name. When you clone a repo, local repo root folder will be same as remote repo name. Both local repo root folder name and remote repo name are independent of each other. When you change local repo root folder name, It doesn't impact the remote repo name even when you push the code. Similarly changing the remote repo name doesn't impact the local repo root folder name in your machine.

因此,您可以使用任何名称创建一个新的空文件夹,并使用 git init 将其设为 git 存储库。 您可以将其指向任何远程仓库。本地 repo 文件夹名称和远程 repo 名称不必相同。通过添加相应的远程 URL,可以将同一个本地仓库推送到多个远程仓库。