How to Set Up a Local Git Server on macOS with Gitblit in Minutes
This guide walks you through installing JDK, downloading and configuring Gitblit, starting the service, and creating repositories on a macOS machine, providing a lightweight local Git server for private LAN use or learning without relying on external platforms.
Why Set Up a Local Git Server?
Git dominates version‑control usage; a local Git server is useful when code cannot be hosted on public platforms, when collaboration is limited to a LAN, or for learning purposes.
Environment Preparation
Install a JDK (required by Gitblit) on macOS. JDK 8 can be downloaded from Oracle:
https://www.oracle.com/java/technologies/javase/javase-jdk8-downloads.html
Download and Install Gitblit
Obtain the Linux/OSX package from the official site:
http://gitblit.github.io/gitblit/
Download gitblit-1.9.1.tar.gz, extract it (e.g., to ~/gitblit), and edit the defaults.properties file located in the data directory.
# Absolute path for repository storage
git.repositoriesFolder = /path/to/your/repositories
# HTTP port for the web UI
server.httpPort = 7070Start the Server
From the Gitblit root directory run the startup script:
./gitblit.shThe console prints a URL such as http://127.0.0.1:7070. Access the web UI with that address (replace 127.0.0.1 with the machine’s LAN IP for remote access). The default credentials are admin / admin.
Create a Repository
Log in to the web admin panel, navigate to “Repositories”, and click “Create Repository”. Provide a name and initialize the repository.
Clone the repository from another machine on the LAN using the SSH URL shown in the UI, for example:
git clone ssh://[email protected]:29418/project.gitStandard Git commands ( git clone, git init, git push, etc.) work as with any remote service. This guide assumes the client already has a configured SSH key.
Key Points
Local Git server provides private code management and LAN‑only collaboration.
Gitblit is lightweight compared with full‑featured platforms such as GitLab.
Configuration mainly involves setting git.repositoriesFolder and server.httpPort.
Repositories are managed through the web UI without additional infrastructure.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
Senior Brother's Insights
A public account focused on workplace, career growth, team management, and self-improvement. The author is the writer of books including 'SpringBoot Technology Insider' and 'Drools 8 Rule Engine: Core Technology and Practice'.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
