Skip to content
Tech News
← Back to articles

Local Git Remotes

read original get Git Remote Management Book → more articles
Why This Matters

This article highlights the benefits of setting up local git remotes, especially for developers working with offsite or unreliable servers. By creating local or private remote repositories, users can streamline their workflow, reduce dependency on external services, and improve productivity and reliability. This approach empowers developers to maintain control over their code and ensures smoother collaboration even when external servers face downtime or restrictions.

Key Takeaways

Local git remotes

As part of working on cani I was also using a variety of git remotes. One of the remotes was hosted on a server I have at home. Here’s how I set that up.

Let’s say the server has a project in a folder called cani . This folder has the code and a .git/ directory:

/home/user/projects/cani

We can use the above folder to clone a bare repository (can be used as a remote without causing weird conflicts):

cd /home/user/bares git clone --bare /home/user/projects/cani # creates /home/user/bares/cani.git

To add this bare repository as a remote to push & pull from can look like a few different ways. Here’s the remote while on the same machine:

git remote add local /home/user/bares/cani.git

Here’s how you can set up the remote when pushing from another machine:

git remote add local ssh://USER@MACHINE:/home/user/bares/cani.git

... continue reading