Parts in the carton
Gather these before you start · 2 min
Nothing here is paid software. Forgejo, Docker, and Git are free.
One Ubuntu computer
This is the host. It only needs to be on when you want to sync. A spare laptop or mini PC is enough.
Three Windows computers
Desktops or laptops on the same home network as Ubuntu.
The same Wi-Fi or wired network
Forgejo will live on your LAN. You do not need to expose it to the internet.
An Ubuntu account that can use sudo
You will type a few terminal commands. Copy them exactly.
Git for Windows installer
Download from git-scm.com on each Windows PC. Free. Keep the default options.
Optional: a Microsoft account for OneDrive
Only if you want a cloud copy of the server data as a spare tire.
Build the Ubuntu server
On the Ubuntu computer only · 25–40 min
Install Forgejo — a free, lightweight Git workshop that looks and acts like GitHub, but it lives in your house.
Open Terminal
Press Ctrl + Alt + T, or search for Terminal in the Ubuntu menu. Leave this window open for the rest of section A.
Update the system
Paste this, press Enter, then type your password if asked. Wait until it finishes.
sudo apt update && sudo apt upgrade -yInstall Docker
This is the free engine that will run Forgejo in a box so the rest of Ubuntu stays clean.
sudo apt install -y docker.io docker-compose-plugin git curlTurn Docker on so it starts with the computer
sudo systemctl enable --now dockerAdd yourself to the docker group
Without this, every Docker command would ask for sudo.
sudo usermod -aG docker $USERLog out of Ubuntu, then log back in
The group change only takes effect after a new login. Close Terminal, sign out, sign in, then open Terminal again.
Caution. If you skip this, the next Docker commands will say permission denied.
Make a folder for Forgejo
mkdir -p ~/forgejo && cd ~/forgejoCreate the recipe file
This file tells Docker what to run. Open the file, paste the block below, save, and close. SQLite is built in — you do not need a separate database for a home setup.
nano ~/forgejo/docker-compose.ymlnetworks:
forgejo:
external: false
services:
server:
image: codeberg.org/forgejo/forgejo:16
container_name: forgejo
environment:
- USER_UID=1000
- USER_GID=1000
restart: always
networks:
- forgejo
volumes:
- ./data:/data
- /etc/localtime:/etc/localtime:ro
ports:
- "3000:3000"
- "222:22"
Start Forgejo
The first start downloads the image. Give it a minute.
cd ~/forgejo && docker compose up -dConfirm it is running
You should see a container named forgejo with status Up.
docker psWrite down the Ubuntu IP address
The first number is usually the one the Windows PCs will use. Example: 192.168.1.42. Write it on paper. You will need it in every later section.
hostname -I | awk '{print $1}'Note. If the address starts with 172. and you also have a 192.168. number, use the 192.168. one.
Open the door on the firewall, if you use one
Skip this if ufw is not active. If you are not sure, run the status command first.
sudo ufw status
sudo ufw allow 3000/tcp
sudo ufw allow 222/tcpOpen the installer in a browser
On Ubuntu, visit http://localhost:3000. From a Windows PC on the same network, visit http://YOUR-IP:3000 (use the IP from the previous step).
Choose SQLite3 as the database
One file. No extra service. Perfect for a household workshop.
Fill in the site address
Server Domain: YOUR-IP (just the numbers, no http). SSH Port: 222. HTTP Port: 3000. Forgejo Base URL: http://YOUR-IP:3000/
Caution. If you later give the Ubuntu machine a new IP, you will need to update this Base URL in Forgejo site settings.
Create the first administrator account
Pick a username, email, and a password you will remember. This is the key to the workshop. Write it down.
Press Install Forgejo and wait
When it finishes you will land on the sign-in page. Sign in with the admin account you just made.
Create your first repository
Click the + in the top right, then New Repository. Give it a short name, for example family-notes. Tick Initialize repository if you want a README to start with. Create.
Copy the HTTP clone address
On the repo page, click HTTPS. Copy the URL. It looks like http://YOUR-IP:3000/yourusername/family-notes.git. You will paste this on each Windows PC.
Connect each Windows computer
Repeat on Windows PC 1, then 2, then 3 · 10–15 min per PC
Each Windows machine gets its own local copy of the repo. Use the tabs below and finish one computer before you start the next.
Download Git for Windows
On that PC, open a browser and go to git-scm.com. Download the Windows installer. Run it.
Install with the recommended options
When asked, choose Git from the command line and also from 3rd-party software. Leave the rest on defaults. Finish and close the installer.
Open Git Bash
Click Start, type Git Bash, open it. You can also use Command Prompt. The commands below work in both.
Confirm Git is installed
You should see a version number, not an error.
git --versionSet the name that will appear on commits
Use the real name of the person who uses this PC, so you can tell whose changes are whose.
git config --global user.name "Your Name"Set the email for commits
git config --global user.email "[email protected]"Open Forgejo from this PC
In a browser, go to http://YOUR-UBUNTU-IP:3000 and sign in. If the page does not load, the Ubuntu machine is off, on a different network, or the IP changed.
Clone the repository onto this PC
This creates a folder with a full local copy. You can work in that folder even when Ubuntu is asleep.
git clone http://YOUR-UBUNTU-IP:3000/yourusername/your-repo.gitNote. Git will ask for the Forgejo username and password. On Windows, Git Credential Manager can remember them.
Go into the folder
cd your-repoMake a tiny test change
This proves the wire works before you put real work in.
echo Hello from this Windows PC >> from-this-pc.txt
git add .
git commit -m "Test from this PC"
git push origin mainNote. If the default branch is master, use master instead of main. Check with: git branch
Refresh the Forgejo page in the browser
You should see the new file and the commit. If you do, this Windows computer is connected. Repeat this whole section on the next PC.
Daily workflow when Ubuntu is not always on
On any Windows computer · 2 min whenever you sync
You can write and save all day with Ubuntu off. Commits stay on that PC. Sync only happens while the server is awake.
How the pieces talk
Ubuntu off: commit locally. Ubuntu on: pull, then push. The three Windows machines never sync to each other directly.
Work offline any time
Edit files in your local repo folder. Git add and git commit work with Ubuntu off. Push and pull do not. They need the server.
git add .
git commit -m "What I changed"When you want to sync, power on Ubuntu
Wait about one minute. Forgejo is set to restart: always, so it comes back by itself.
Confirm the workshop is open
On a Windows browser, load http://YOUR-UBUNTU-IP:3000. If it loads, you can sync.
docker psNote. Run docker ps on Ubuntu if you want to double-check. You should see forgejo Up.
PULL first — get other people's work
On the Windows PC you are using, open the repo folder and pull. This copies commits FROM the Ubuntu server TO this PC.
cd your-repo
git pull origin mainCaution. Always pull before you push. If two PCs committed while Ubuntu was off, the second one to push will be rejected until it pulls.
PUSH — send this PC's work to Ubuntu
This copies commits FROM this PC TO the Ubuntu server. The other Windows computers will not see it until they pull.
git push origin mainOn the other two Windows PCs, pull
Each machine has its own folder. Each one must pull to catch up. There is no magic sync between Windows PCs — Ubuntu is the meeting point.
cd your-repo
git pull origin mainIf Git talks about a merge conflict
Two PCs edited the same lines. Open the listed files, look for the conflict markers, keep the right text, then:
git add .
git commit -m "Merge both computers"
git push origin mainYou may shut Ubuntu down after everyone has pushed
You do not need to stop Docker first. Just shut down the computer as usual. Next time you power it on, Forgejo starts again.
Optional: back up to OneDrive
On Ubuntu, before a long shutdown · 15 min the first time
The live copy lives in ~/forgejo/data. OneDrive is a spare, not the daily sync. Git already copies history to every PC that has cloned.
Pause Forgejo before copying, if it is running
A quiet copy is a clean copy.
cd ~/forgejo && docker compose stopInstall rclone
sudo apt install -y rcloneConnect rclone to OneDrive
Follow the prompts. Choose Microsoft OneDrive, sign in in the browser it opens, then give the remote a short name such as onedrive.
rclone configCopy the data folder to OneDrive
rclone copy ~/forgejo/data onedrive:forgejo-backup --progressNote. Replace onedrive with the remote name you chose. Run this whenever you want a fresh spare.
Start Forgejo again
cd ~/forgejo && docker compose startWords on the box
Keep this nearby
Push and pull are two directions. Mixing them up is the usual snag.
- Pull
- Download commits from Ubuntu onto this computer. Use it to catch up.
- Push
- Upload this computer's commits to Ubuntu. Other PCs will not see them until they pull.
- Commit
- A snapshot saved on this computer. Works with Ubuntu off. Nothing leaves the PC until you push.
- Clone
- The first copy. Creates the folder on a new computer and points it at Ubuntu.
- Origin
- Git's nickname for the Ubuntu Forgejo server.
No sign-in — progress stays on this device. Say the word and I will add accounts.