DE version is available. Content is displayed in original English for accuracy.
Advertisement
Advertisement
⚡ Community Insights
Discussion Sentiment
83% Positive
Analyzed from 2067 words in the discussion.
Trending Topics
#git#local#remote#repo#github#push#same#clone#don#shared

Discussion (73 Comments)Read Original on HackerNews
For example, `git remote -v` would show: `secure-s3 /mnt/fuse/rclone/secure-s3/git/$REPO.git`
I think concurrency is a problem with file-based remotes but for one person keeping a desktop and laptop in sync it is much simpler than running a VPS.
App still working tho.
git user is restricted to git-shell and the agent has a passwordless SSH key to access git@host:/home/git/project.git. On the host, I push/pull to git@localhost:/home/git/project.git (sidestepping fiddling with git safe.directory settings for each project).
Seemed like an easy way for local sync without giving the untrusted VM access to a writable shared filesystem?
Being able to target a shared SSH server in your control while the upstream service is down is pretty freeing... and even if you aren't releasing to production/test/etc, you can keep making shared progress.. even more important with trunk based development.
Aside from that unique use case, I might consider this for storing code on a network attached drive (archival).
Check it out from '/tmp' and make sure it still builds.
For a single-dev or small team, it beats having to do github runner epicycles to accomplish the same basic goal. Add in Firejail if you want environment isolation.
Having a “local remote” would be an awfully quick way to do that, especially in situations with no/low network connection or a flakey upstream server.
And I recon this is the default workflow for most people most of the time.
eventually I can set up a proper git repo, set up credentials, etc.
I think it's like how some people use 127.0.0.1 for stuff, then later expand the software engineering process to do it right.
I have lots of projects under for version control with no remotes.
backup? peace of mind?
And I push to GitHub/GitLab from a repo outside the sandboxes.
btw, Git also supports the HTTP protocol ...
In fact, Git supports any protocol! If you add a git remote like
Then pushing/pulling `my-remote` will try to invoke a command called `git-remote-my-super-duper-protocol`, with `some-sort-of-address-thingy` in its arguments. You can implement that however you like.I use remotes like "pkipfs::y5a9inx61aski4miz4sgmg55qgbazxhfwab3i6ee1ypa6rnumi8o", which invokes a custom git-remote-pkipfs command that pushes/pulls object data to IPFS and resolves/updates refs as subdomains of a specified pkarr address.
Putting the generic term into your corporation's name can be effective means of claiming things that don't belong to you.
Jon Postel reserved 44.0.0.0/8 for a generic purpose: "amateur radio digital communications." Decades later, there was a successful heist when some enterprising individuals who had incorporated "Amateur Radio Digital Communications" misrepresented to ARIN that the assignment had actually been theirs. Immediately after ARIN gave them transfer rights, they pocketed 8 figures reselling the space to Amazon.
Github obviously isn't making explicit claims like this but they benefit whenever people with purchasing power implicitly understand that github is the only option.
edited: Amateur Radio Digital Communications is not an LLC
> A related trick worth knowing — one git push can fan out to two destinations:
git remote set-url --add --push origin ~/bares/<repo>.git # add a 2nd push URL # now `git push origin` writes to GitHub AND the local bare repo
Also handy if you're running an agent in a container on the local fs. Set up a local clone, contain the agent to that repo folder and have it hack away on that. Later, you step out of the container and do the syncing. You can't use worktrees in this situations.
Bare repos are also pretty cool. You can clone the git mailing list as a bare repo and search for threads there instead of setting up an mbox (same for the kernel obviously)
[1]: https://git-scm.com/docs/git-worktree
I think you mean hardlinks the object database? The index (staging area) changes constantly. Not much point in hardlinking it.
Hardlinking the object database is the default behavior with you clone locally on linux. It's great for one-off clones such as CI/CD pipelines and agentic containers, but the benefit in terms of disk space saved is short-lived: as repos evolve independently, they replace their packfiles with new ones, and the new ones will not be hardlinked because they don't contain the same objects.
I like to keep bare repositories in dropbox, but I use `--no-hardlinks` when cloning, because before I did that, on one occasion, dropbox corrupted the bare repo, and my working repo was corrupted as a result.
Note that you can share objects across clones on the same machine in various ways. See "--local", "--shared", and "--reference" in the git-clone man page. (GitHub uses this feature heavily. Or at least they did. I have no idea what their backend implementation is these days, but they must be doing some sort of copy-on-write CAS for forks.)