git 未找到包含裸存储库的重新安装的 USB 驱动器

git is not finding remounted USB drive which contains a bare repository

我在 USB 驱动器上启动了一个裸存储库,因此我可以对多个 machines 进行良好的版本控制。

在 machine (mac) 上克隆 USB 存储库后,我移除了 USB 并继续处理克隆的本地副本。然后我将 usb 重新安装到 machine 并试图将我的工作推送到 usb 上。但是,当我尝试 push

时出现此错误
git push usb master
fatal: 'usb' 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 没有找到任何远程存储库。当我尝试时,git remote 没有远程存储库出现。我还确保将 USB 重新安装到同一端口,但问题仍然存在。我需要以某种方式重新建立连接吗?

添加 USB repo remote,然后你就可以推送它了:

git remote add myUSB /path/to/usb/repo
# then you could do
git fetch myUSB
git push myUSB some-branch