79834935

Date: 2025-12-01 14:15:29
Score: 0.5
Natty:
Report link

Here, this is what I use on a daily basis when I try to avoid online services such as Github, Gitlab... Of course when I don't need the CI/CD and the bells and whistles such as actions, accounts, etc.

This answer is for future reference regarding how to achieve a full Git workflow without relying on a remote Git hosting service (like GitHub, GitLab, etc.), by using a local bare repository as your "remote."


💻 Full Git Experience with a Local Bare Repository

You can replicate the standard Git workflow (clone, commit, push, pull, etc.) entirely on your local machine by setting up a bare repository to serve as your central, shared history.

1️⃣ Setting Up the "Remote" (Bare Repository)

First, create a bare Git repository in a designated, central location on your machine. This directory will not contain a working tree (i.e., no files, just the Git history).

  1. Pick a directory for your bare repo (e.g., in your home directory).

    Bash

    mkdir ~/my-project-bare.git
    cd ~/my-project-bare.git
    git init --bare
    
    

2️⃣ Setting Up the Working Copy (Local Clone)

Now, treat that bare repository path as the "remote URL" and clone it into your actual working directory.

  1. Move to a different location where you want your project files to reside.

    Bash

    cd /path/to/my/development/area
    
    
  2. Clone the local bare repository using its file path.

    Bash

    git clone ~/my-project-bare.git my-project-working
    cd my-project-working
    
    

3️⃣ Standard Workflow

From this point on, all Git operations are exactly the same as if you were using an external remote.

The ~/my-project-bare.git directory now acts as your central source of truth. If you want to simulate multiple developers or different machines, you can simply clone the bare repo again into a different folder (e.g., my-project-testing), and use git pull and git push between the working clones and the bare repo.

Reasons:
  • Blacklisted phrase (1): how to achieve
  • Long answer (-1):
  • Has code block (-0.5):
  • Low reputation (1):
Posted by: Chihabeddine AOURINMOUCHE