{"id":678,"date":"2026-07-20T08:12:24","date_gmt":"2026-07-20T08:12:24","guid":{"rendered":"https:\/\/virtualserversvps.com\/blog\/?p=678"},"modified":"2026-07-20T08:12:24","modified_gmt":"2026-07-20T08:12:24","slug":"vps-git-server-setup-guide-technical-2026","status":"publish","type":"post","link":"https:\/\/virtualserversvps.com\/blog\/vps-git-server-setup-guide-technical-2026\/","title":{"rendered":"Setting Up a Git Server on Your VPS: A Step-by-Step Guide for Developers"},"content":{"rendered":"<p class=\"wp-block-paragraph\">Self-hosting a Git server on your VPS gives you complete control over your code repositories, no per-user pricing, and unlimited private repos. Whether you choose Gitea (lightweight, Go-based) or GitLab CE (full-featured, Ruby-based), this guide walks through the entire setup process on a Ubuntu 24.04 VPS. Before you start, <a href=\"https:\/\/virtualserversvps.com\/#providers\">compare VPS plans on our comparison table<\/a> to ensure your server has enough resources for your chosen platform.<\/p>\n\n<h2 class=\"wp-block-heading\">Prerequisites<\/h2>\n\n<ul class=\"wp-block-list\">\n<li>A VPS running Ubuntu 24.04 LTS with at least 1 vCPU and 1 GB RAM (2 GB+ recommended for GitLab).<\/li>\n<li>Root or sudo access.<\/li>\n<li>A domain name (or subdomain) pointed to your VPS IP for HTTPS access.<\/li>\n<li>Ports 22 (SSH), 80 (HTTP), and 443 (HTTPS) open in your firewall.<\/li>\n<\/ul>\n\n<h2 class=\"wp-block-heading\">Option 1: Installing Gitea (Lightweight, &lt; 1 GB RAM)<\/h2>\n\n<p class=\"wp-block-paragraph\">Gitea is the most resource-efficient self-hosted Git platform. It&#8217;s written in Go, uses SQLite by default, and runs comfortably on a 1 GB RAM VPS.<\/p>\n\n<h2 class=\"wp-block-heading\">Step 1: Install Dependencies<\/h2>\n\n<pre class=\"wp-block-code\"><code>sudo apt update &amp;&amp; sudo apt upgrade -y\nsudo apt install -y git curl sqlite3<\/code><\/pre>\n\n<h2 class=\"wp-block-heading\">Step 2: Create a Dedicated User<\/h2>\n\n<pre class=\"wp-block-code\"><code>sudo adduser --system --shell \/bin\/bash --gecos \"Git Version Control\" --group --disabled-password --home \/home\/git git<\/code><\/pre>\n\n<h2 class=\"wp-block-heading\">Step 3: Download and Install Gitea<\/h2>\n\n<pre class=\"wp-block-code\"><code>sudo mkdir -p \/var\/lib\/gitea \/etc\/gitea \/usr\/local\/bin\nsudo chown -R git:git \/var\/lib\/gitea \/etc\/gitea\nsudo wget -O \/usr\/local\/bin\/gitea https:\/\/dl.gitea.com\/gitea\/1.22\/gitea-1.22-linux-amd64\nsudo chmod +x \/usr\/local\/bin\/gitea<\/code><\/pre>\n\n<h2 class=\"wp-block-heading\">Step 4: Create systemd Service<\/h2>\n\n<pre class=\"wp-block-code\"><code>sudo tee \/etc\/systemd\/system\/gitea.service &lt;&lt; EOF\n[Unit]\nDescription=Gitea (Git with a cup of tea)\nAfter=network.target\n\n[Service]\nExecStart=\/usr\/local\/bin\/gitea web --config \/etc\/gitea\/app.ini\nWorkingDirectory=\/var\/lib\/gitea\nUser=git\nGroup=git\nRestart=always\n\n[Install]\nWantedBy=multi-user.target\nEOF\n\nsudo systemctl daemon-reload\nsudo systemctl enable --now gitea<\/code><\/pre>\n\n<h2 class=\"wp-block-heading\">Step 5: Set Up Nginx Reverse Proxy<\/h2>\n\n<pre class=\"wp-block-code\"><code>sudo apt install -y nginx certbot python3-certbot-nginx\nsudo tee \/etc\/nginx\/sites-available\/gitea &lt;&lt; EOF\nserver {\n    listen 80;\n    server_name git.yourdomain.com;\n\n    location \/ {\n        proxy_pass http:\/\/localhost:3000;\n        proxy_set_header Host \\$host;\n        proxy_set_header X-Real-IP \\$remote_addr;\n        proxy_set_header X-Forwarded-For \\$proxy_add_x_forwarded_for;\n        proxy_set_header X-Forwarded-Proto \\$scheme;\n    }\n}\nEOF\n\nsudo ln -s \/etc\/nginx\/sites-available\/gitea \/etc\/nginx\/sites-enabled\/\nsudo nginx -t &amp;&amp; sudo systemctl reload nginx\nsudo certbot --nginx -d git.yourdomain.com<\/code><\/pre>\n\n<p class=\"wp-block-paragraph\">Visit https:\/\/git.yourdomain.com to complete the Gitea web installer. Choose SQLite3 as the database, set your admin credentials, and you&#8217;re done.<\/p>\n\n<h2 class=\"wp-block-heading\">Option 2: Installing GitLab CE (Full-Featured, 2 GB+ RAM)<\/h2>\n\n<p class=\"wp-block-paragraph\">GitLab Community Edition includes CI\/CD pipelines, container registry, issue tracking, and wiki pages. It&#8217;s heavier \u2014 expect 1.5\u20132 GB RAM usage at idle \u2014 but offers more built-in features.<\/p>\n\n<h2 class=\"wp-block-heading\">Step 1: Install Dependencies<\/h2>\n\n<pre class=\"wp-block-code\"><code>sudo apt update &amp;&amp; sudo apt upgrade -y\nsudo apt install -y curl openssh-server ca-certificates tzdata perl<\/code><\/pre>\n\n<h2 class=\"wp-block-heading\">Step 2: Add GitLab Repository and Install<\/h2>\n\n<pre class=\"wp-block-code\"><code>curl -sS https:\/\/packages.gitlab.com\/install\/repositories\/gitlab\/gitlab-ce\/script.deb.sh | sudo bash\nsudo EXTERNAL_URL=\"https:\/\/git.yourdomain.com\" apt install -y gitlab-ce<\/code><\/pre>\n\n<h2 class=\"wp-block-heading\">Step 3: Configure Firewall<\/h2>\n\n<pre class=\"wp-block-code\"><code>sudo ufw allow 22\/tcp\nsudo ufw allow 80\/tcp\nsudo ufw allow 443\/tcp\nsudo ufw enable<\/code><\/pre>\n\n<h2 class=\"wp-block-heading\">Step 4: Get Initial Root Password<\/h2>\n\n<pre class=\"wp-block-code\"><code>sudo cat \/etc\/gitlab\/initial_root_password<\/code><\/pre>\n\n<p class=\"wp-block-paragraph\">Visit https:\/\/git.yourdomain.com and log in with username <code>root<\/code> and the initial password. GitLab automatically handles SSL via Let&#8217;s Encrypt if your domain DNS resolves correctly.<\/p>\n\n<h2 class=\"wp-block-heading\">Post-Installation Hardening<\/h2>\n\n<ul class=\"wp-block-list\">\n<li><strong>Enable SSH Git access:<\/strong> Add your public key to Gitea\/GitLab under User Settings &gt; SSH Keys. Clone repos using git@git.yourdomain.com:username\/repo.git.<\/li>\n<li><strong>Set up automated backups:<\/strong> For Gitea, run gitea dump &#8211;file \/backups\/gitea-$(date +%Y%m%d).zip via cron. For GitLab, use sudo gitlab-backup create.<\/li>\n<li><strong>Configure email:<\/strong> Set up SMTP in Gitea (app.ini) or GitLab (gitlab.rb) so users receive registration and notification emails.<\/li>\n<li><strong>Enable two-factor authentication:<\/strong> Enforce 2FA for all users in your Git platform&#8217;s admin settings.<\/li>\n<li><strong>Monitor disk usage:<\/strong> Git repositories grow fast. Set up a cron job to alert you when \/var\/lib\/gitea or \/var\/opt\/gitlab exceeds 80% usage.<\/li>\n<\/ul>\n\n<h2 class=\"wp-block-heading\">Which Should You Choose?<\/h2>\n\n<p class=\"wp-block-paragraph\"><strong>Choose Gitea if:<\/strong> You want a lightweight, fast Git server for a small team (1\u201310 developers). It runs on a $5\u201310\/month VPS and uses under 200 MB RAM at idle. Setup takes 15 minutes.<br><strong>Choose GitLab CE if:<\/strong> You need built-in CI\/CD runners, container registry, and project management. Budget at least 2 GB RAM and 20 GB storage. Setup takes 30\u201345 minutes.<\/p>\n\n<p class=\"wp-block-paragraph\">Both platforms support standard Git workflows \u2014 push, pull, merge requests, branching \u2014 and integrate with popular CI\/CD tools. Self-hosting eliminates per-user SaaS fees and gives you full data ownership. <a href=\"https:\/\/virtualserversvps.com\/#providers\">Check our VPS comparison table<\/a> to find the right server specs for your self-hosted Git setup.<\/p>","protected":false},"excerpt":{"rendered":"<p>Self-hosting a Git server on your VPS gives you complete control over your code repositories, no per-user pricing, and unlimited private repos. Whether you choose Gitea (lightweight, Go-based) or GitLab&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"iawp_total_views":0,"footnotes":""},"categories":[1],"tags":[],"class_list":["post-678","post","type-post","status-publish","format-standard","hentry","category-vps-guides-tutorials"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v26.1 (Yoast SEO v26.1) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Setting Up a Git Server on Your VPS: A Step-by-Step Guide for Developers - Virtual Servers VPS Blog<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/virtualserversvps.com\/blog\/vps-git-server-setup-guide-technical-2026\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Setting Up a Git Server on Your VPS: A Step-by-Step Guide for Developers\" \/>\n<meta property=\"og:description\" content=\"Setting Up a Git Server on Your VPS: A Step-by-Step Guide for Developers\" \/>\n<meta property=\"og:url\" content=\"https:\/\/virtualserversvps.com\/blog\/vps-git-server-setup-guide-technical-2026\/\" \/>\n<meta property=\"og:site_name\" content=\"Virtual Servers VPS Blog\" \/>\n<meta property=\"article:published_time\" content=\"2026-07-20T08:12:24+00:00\" \/>\n<meta name=\"author\" content=\"Virtual-Servers-Vps-Editor\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Virtual-Servers-Vps-Editor\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/virtualserversvps.com\/blog\/vps-git-server-setup-guide-technical-2026\/\",\"url\":\"https:\/\/virtualserversvps.com\/blog\/vps-git-server-setup-guide-technical-2026\/\",\"name\":\"Setting Up a Git Server on Your VPS: A Step-by-Step Guide for Developers - Virtual Servers VPS Blog\",\"isPartOf\":{\"@id\":\"https:\/\/virtualserversvps.com\/blog\/#website\"},\"datePublished\":\"2026-07-20T08:12:24+00:00\",\"author\":{\"@id\":\"https:\/\/virtualserversvps.com\/blog\/#\/schema\/person\/82a299a8284a66ff49f97c74684724a0\"},\"breadcrumb\":{\"@id\":\"https:\/\/virtualserversvps.com\/blog\/vps-git-server-setup-guide-technical-2026\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/virtualserversvps.com\/blog\/vps-git-server-setup-guide-technical-2026\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/virtualserversvps.com\/blog\/vps-git-server-setup-guide-technical-2026\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/virtualserversvps.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Setting Up a Git Server on Your VPS: A Step-by-Step Guide for Developers\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/virtualserversvps.com\/blog\/#website\",\"url\":\"https:\/\/virtualserversvps.com\/blog\/\",\"name\":\"Virtual Servers VPS Blog\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/virtualserversvps.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/virtualserversvps.com\/blog\/#\/schema\/person\/82a299a8284a66ff49f97c74684724a0\",\"name\":\"Virtual-Servers-Vps-Editor\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/virtualserversvps.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/d820b15f1cd028e97610d9adf536df7be5cb6423869967037d468d5355fa003f?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/d820b15f1cd028e97610d9adf536df7be5cb6423869967037d468d5355fa003f?s=96&d=mm&r=g\",\"caption\":\"Virtual-Servers-Vps-Editor\"},\"sameAs\":[\"https:\/\/virtualserversvps.com\/blog\"],\"url\":\"https:\/\/virtualserversvps.com\/blog\/author\/virtualserversvps\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Setting Up a Git Server on Your VPS: A Step-by-Step Guide for Developers - Virtual Servers VPS Blog","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/virtualserversvps.com\/blog\/vps-git-server-setup-guide-technical-2026\/","og_locale":"en_US","og_type":"article","og_title":"Setting Up a Git Server on Your VPS: A Step-by-Step Guide for Developers","og_description":"Setting Up a Git Server on Your VPS: A Step-by-Step Guide for Developers","og_url":"https:\/\/virtualserversvps.com\/blog\/vps-git-server-setup-guide-technical-2026\/","og_site_name":"Virtual Servers VPS Blog","article_published_time":"2026-07-20T08:12:24+00:00","author":"Virtual-Servers-Vps-Editor","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Virtual-Servers-Vps-Editor","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/virtualserversvps.com\/blog\/vps-git-server-setup-guide-technical-2026\/","url":"https:\/\/virtualserversvps.com\/blog\/vps-git-server-setup-guide-technical-2026\/","name":"Setting Up a Git Server on Your VPS: A Step-by-Step Guide for Developers - Virtual Servers VPS Blog","isPartOf":{"@id":"https:\/\/virtualserversvps.com\/blog\/#website"},"datePublished":"2026-07-20T08:12:24+00:00","author":{"@id":"https:\/\/virtualserversvps.com\/blog\/#\/schema\/person\/82a299a8284a66ff49f97c74684724a0"},"breadcrumb":{"@id":"https:\/\/virtualserversvps.com\/blog\/vps-git-server-setup-guide-technical-2026\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/virtualserversvps.com\/blog\/vps-git-server-setup-guide-technical-2026\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/virtualserversvps.com\/blog\/vps-git-server-setup-guide-technical-2026\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/virtualserversvps.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Setting Up a Git Server on Your VPS: A Step-by-Step Guide for Developers"}]},{"@type":"WebSite","@id":"https:\/\/virtualserversvps.com\/blog\/#website","url":"https:\/\/virtualserversvps.com\/blog\/","name":"Virtual Servers VPS Blog","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/virtualserversvps.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/virtualserversvps.com\/blog\/#\/schema\/person\/82a299a8284a66ff49f97c74684724a0","name":"Virtual-Servers-Vps-Editor","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/virtualserversvps.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/d820b15f1cd028e97610d9adf536df7be5cb6423869967037d468d5355fa003f?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/d820b15f1cd028e97610d9adf536df7be5cb6423869967037d468d5355fa003f?s=96&d=mm&r=g","caption":"Virtual-Servers-Vps-Editor"},"sameAs":["https:\/\/virtualserversvps.com\/blog"],"url":"https:\/\/virtualserversvps.com\/blog\/author\/virtualserversvps\/"}]}},"_links":{"self":[{"href":"https:\/\/virtualserversvps.com\/blog\/wp-json\/wp\/v2\/posts\/678","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/virtualserversvps.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/virtualserversvps.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/virtualserversvps.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/virtualserversvps.com\/blog\/wp-json\/wp\/v2\/comments?post=678"}],"version-history":[{"count":1,"href":"https:\/\/virtualserversvps.com\/blog\/wp-json\/wp\/v2\/posts\/678\/revisions"}],"predecessor-version":[{"id":681,"href":"https:\/\/virtualserversvps.com\/blog\/wp-json\/wp\/v2\/posts\/678\/revisions\/681"}],"wp:attachment":[{"href":"https:\/\/virtualserversvps.com\/blog\/wp-json\/wp\/v2\/media?parent=678"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/virtualserversvps.com\/blog\/wp-json\/wp\/v2\/categories?post=678"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/virtualserversvps.com\/blog\/wp-json\/wp\/v2\/tags?post=678"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}