Methods of payment Abuse

How to Set Up Your Own Git Server on Windows Server: Gitea as a GitHub Alternative

  • Main
  • Knowledge base
  • How to Set Up Your Own Git Server on Windows Server: Gitea as a GitHub Alternative
02.07.2025, 16:35

When you're working on a project as a team, Git is essential. It tracks changes, lets you work in parallel, compare versions, and roll back when needed. Most people use GitHub or other cloud-based platforms. But what if you can't—or don’t want to—store code outside your company? In that case, setting up a local Git server is the way to go. And yes, you can do it on Windows Server. One of the easiest tools for the job is Gitea — it’s lightweight, doesn’t require complicated setup, and runs great on Windows.

What You’ll Need

— A server running Windows Server (2016, 2019, or 2022), or Windows 10/11 Pro.
— Internet access to download the required files.
— Administrator privileges.

We’ll walk through the entire process: installing Git, setting up SSH, running Gitea, and creating your first repository.

Step 1: Install Git and Set Up SSH

Let’s start with Git itself.

— Head over to the official Git website and download the installer. It should automatically detect your version of Windows.
— Run the installer as administrator.
— You can safely click through with the default settings — they’re fine for most users.
— After installation, you’ll see Git Bash and Git GUI in your Start menu. We’ll be using Git Bash.

Set Up SSH

SSH lets you connect securely without entering your username and password every time.

1. Open Git Bash

Run:

ssh -V

If you see the OpenSSH version, you’re good to go.

2. Now create an SSH key:

 ssh-keygen -t rsa -b 4096 -C "git@your-server"

—  The label (git@your-server) is just for reference.
— Hit Enter through all prompts — let it use default paths and skip setting a passphrase.

This will generate two files:
— id_rsa — your private key (keep this secure)
— id_rsa.pub — your public key (we’ll use this later)

Check the files are there:

ls ~/.ssh

Step 2: Install and Run Gitea on Windows Server

Gitea is a self-hosted web app that gives you GitHub-like functionality: repositories, commits, user management, and more.

Prepare the Folder
— Create a folder like C:\Gitea\
Download the Windows version of Gitea from the official site
— Rename the downloaded file to gitea.exe and move it to the folder

(Optional but recommended) Create a Dedicated User

— Press Win + R, type compmgmt.msc, and hit Enter
— Go to Local Users and Groups → Users, and create a new user — e.g., gitea_user
— Uncheck “User must change password” and check “Password never expires”

Run Gitea
1. Open Command Prompt as Administrator
2. Navigate to the folder:

cd C:\Gitea


3. Start Gitea:

gitea.exe web

If everything works, you’ll see a message saying the server is running at http://localhost:3000.

First-Time Setup via Web Interface

Open a browser and go to http://localhost:3000.
— Database Type: leave it as SQLite3 (simple, no extra config)
— Path: default is fine
— Repository Root Path: set to C:\Gitea\repos
— Application URL: use http://localhost:3000 for local, or http://<server_ip>:3000 for LAN access
— Admin Account: choose a username and password

Click Install Gitea — and you’re in!

Step 3: Create Your First Repository

— Log in as admin
— Click New Repository
— Give it a name like test, leave it empty for now, and create it

Congrats — your Git server is up and running!

Accessing Gitea from Other Devices

To let others connect open Port 3000 in Windows Firewall:
1. Go to: Control Panel → System and Security → Windows Defender Firewall → Advanced Settings
2. Create a new Inbound Rule
3. Rule type: Port → TCP → Port 3000
4. Allow connection for all profiles
5. Name the rule something like Gitea TCP 3000

Find your server’s IP address with:

 ipconfig

Gitea will now be available at http://<server_ip>:3000 on your network.

Step 4: Set Up SSH Access

So you don’t have to enter a password every time you push/pull from a repo.

Enable the SSH Server on Windows
— Go to: Settings → Apps → Optional Features
— Search for and install OpenSSH Server

Then, run the following in PowerShell as administrator:

Start-Service sshd
Set-Service -Name sshd -StartupType 'Automatic'

Open port 22 in the firewall just like you did for port 3000 (same steps, just use 22 instead).

Step 5: Add Your SSH Key to Gitea

On your developer machine:
1. Generate an SSH key (if you haven’t already):

 ssh-keygen

2. Open the .pub file in Notepad and copy its contents

In Gitea:
— Go to Your Profile → Settings → SSH / GPG Keys → Add Key
— Paste the key, give it a name like “Work PC”, and save

Step 6: Test and Clone the Repo

To test the connection:

ssh git@<server_ip> -p 22

If you see:
Hi there, you've successfully authenticated, but Gitea does not provide shell access.

— you’re good to go!

Now clone your repo:

git clone ssh://git@<server_ip>:22/<username>/<repo>.git

Example:

git clone ssh://git@192.168.1.100:22/admin/test.git

If the SSH key is added correctly, it’ll clone without asking for a password.

Bonus: An Alternative to Gitea

If you ever want to try something different, check out GitBucket. It also runs on Windows and offers similar features, though the setup is a bit different and the interface has its own quirks. Still, it’s a solid backup option if Gitea isn’t a perfect fit for your needs.