n1th6
n1th6

Reputation: 21

Portable Git repository on USB drive, submodule setup

I created a bare repo on my us drive, using

git init --bare M:\usb_repo

and on my local repo I added the usb repo and an additional remote using

git remote add usb M:/usb_repo

And I can push/pull to the portable repo from my local system and I can take my portable repo to another system and checkout from the portable repo just fine. My issue is submodules. The repo I', working with uses submodules and I'm unsure of how I deal with them while using a portable repo. I thought maybe going into the local submodule folder/repo and doing the same process of adding the usb as a remote would work, but apparently not.

Is there a specific way of doing this?

Upvotes: 2

Views: 416

Answers (1)

VonC
VonC

Reputation: 1326716

If those submodules, registered in the .gitmodules file of your parent repository, reference external public repository URLs, you don't have anything to do.

If there are referencing other local repositories, then I would use7

  • either the same kind of absolute path as the one for the main repo (M:\myProject1.git/, as bare repository)
  • or a relative URL (but in your case, an absolute path to the external drive is preferable)

Upvotes: 1

Related Questions