10
submitted 2 weeks ago* (last edited 2 weeks ago) by duckduckduck@programming.dev to c/git@programming.dev

Probably silly.

Say I've got a remote repo that is only available sometimes, like a removable drive, and I want to add it as a remote, but I don't want to get an error each--

Actually, maybe disregard... I was just poking about in the CLI and remembered that ofc I could add a named remote without adding its pushurl to my main remote like "origin". So it's actually easiest to just do like

# Add the remote
git clone --bare . /mnt/asdf/asdf
git remote add usb /mnt/asdf/asdf

# Push to it by name whenever
git push usb

Seems intuitive to me, but maybe I'm X/Ying it... how would other people go about having a "sometimes" available remote repo, where you want to track easily and efficiently keep track of all the git history?

top 2 comments
sorted by: hot top new old
[-] INeedMana@piefed.zip 6 points 2 weeks ago

That's exactly what I would do. Including the remote repo being bare

[-] frisbird@lemmy.ml 2 points 2 weeks ago

Yeah, you nailed it.

this post was submitted on 29 Oct 2026
10 points (100.0% liked)

Git

4842 readers
8 users here now

Git is a free and open source distributed version control system designed to handle everything from small to very large projects with speed and efficiency.

Resources

Rules

  1. Follow programming.dev rules
  2. Be excellent to each other, no hostility towards users for any reason
  3. No spam of tools/companies/advertisements. It’s OK to post your own stuff part of the time, but the primary use of the community should not be self-promotion.

Git Logo by Jason Long is licensed under the Creative Commons Attribution 3.0 Unported License.

founded 3 years ago
MODERATORS