首页 > 解决方案 > git 没有找到包含裸存储库的重新安装的 USB 驱动器

问题描述

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

在机器(mac)上克隆 USB 存储库后,我移除了 USB 并继续处理克隆的本地副本。然后我将 USB 重新安装到机器上并尝试将我的工作推送到 USB 上。但是,当我尝试推送时出现此错误

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,但问题仍然存在。我需要以某种方式重新建立连接吗?

标签: gitmacosusbgit-remote

解决方案


添加 USB repo 遥控器,然后您可以推送到它:

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

推荐阅读