Search code examples
gitmacosusbgit-remote

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


I started a bare repository on a USB drive so I can have good version control over multiple machines.

After cloning the USB repository on a machine (mac) I removed the usb and continued working on the cloned, local copy. I then remounted the usb to the machine and attempted to push my work on the usb. However, this error appears when I try to 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.

Which I think means that git is not finding any remote repositories. and when I tried, git remote no remote repositories appear. I also made sure I remounted the USB on the same port but the issue persisted. Do I need to somehow re establish a connection?


Solution

  • Add the USB repo remote and then you could push to it:

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