Local Git Remotes
Recorded: May 29, 2026, 2 p.m.
| Original | Summarized |
local git remotes — alexander cobleigh / cblgh.org Back to postsmapaboutrssnow Local git remotes We can use the above folder to clone a bare repository (can be used as a remote without causing weird conflicts): To add this bare repository as a remote to push & pull from can look like a few different ways. Here’s how you can set up the remote when pushing from another machine: We can associate the branch main as the default branch for remote local: Now we’re ready to push to our local remote! # if remote configured with ssh://USER@ as above Pulling from the configured remote: # with default branch branch `main` For what it’s worth, the ssh://USER@MACHINE syntax can be replaced with any ssh config you |
The text describes a method for establishing and utilizing a local Git remote, particularly beneficial when managing offsite repositories that may experience intermittent availability. The process begins by setting up a bare repository on a local server, for example, in a directory like /home/user/projects/cani, which contains the project code and the necessary .git directory. To use this location effectively as a remote, one can clone a bare version of the project into a separate directory, creating a bare repository like /home/user/bares/cani.git. This bare repository can then be registered as a remote using several configurations depending on whether the operation occurs on the same machine or from an external one. When working on the same machine, the remote is added using a simple command. For pushing from a different machine, the remote is defined using an SSH URL format, such as ssh://USER@MACHINE:/home/user/bares/cani.git. Furthermore, the default branch for this local remote can be explicitly set, such as associating the main branch with the remote named local. Once the remote is configured, pushing and pulling operations are streamlined. Pushing to the local remote can be done either without specifying a remote name or by specifying the local remote name. Pulling operations can also target the local remote, either pulling without specifying a default branch or specifying a particular branch name. The author emphasizes the utility of employing a local remote, noting that it provides a stable destination for pushes and pulls, mitigating issues associated with less reliable, offsite repositories, especially those that are subject to heavy scraping. This setup effectively combines the reliability of a local remote with the functionality of an offsite copy, offering a robust workflow. |