移动后如何修复本地 git repo 的路径?
previous local location: /C/website
new local location: /C/Projects/website
remote location: git@bitbucket.org:username/website.git
我将我的 git 存储库从一个文件夹移动/website
到另一个文件夹/projects/website
,现在出现错误:
user@Thinkpad /C/Projects/website (master)
$ git push
fatal: 'C:/website' does not appear to be a git repository
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
有没有办法解决这个问题而不必重新克隆项目?我试过:
$ git init
Reinitialized existing Git repository in c:/Projects/website/.git/
它什么也没做,当我尝试推动时,我又得到了完全相同的错误。
编辑:
我跑了:git config remote.origin.url C:/Projects/website
。现在,当我在更改文件后提交时,我得到以下回复:
user@Thinkpad /C/Projects/website (master)
$ git commit -m "added something"
[master e163ad9] added something
0 files changed
create mode 100644 something
user@Thinkpad /C/Projects/website (master)
$ git push
Everything up-to-date