Modding

Version Control for GTA 6 Server Mods

Version Control for GTA 6 Server Mods

Every mature GTA server will eventually have custom scripts running. If those scripts aren't version controlled, you're one accidental overwrite away from losing a weekend of work. Follow this minimum git workflow to stay protected.

Why version control matters

  • Rollback. Bad deploy? Reset to the previous commit in 10 seconds.
  • History. See who changed what, when, and why.
  • Collaboration. Multiple developers can work on the same codebase without interfering with each other.
  • Review. Pull requests let you catch bugs before they reach production.
  • Backup. Your mods aren't lost when the server dies.

The minimum setup

  1. Set up a private GitHub/GitLab repo for your server(s).
  2. Add your server's resources folder (or its equivalent) to the repo.
  3. Craft a .gitignore file that ensures you don't accidentally commit secrets (database credentials, API keys, .env files).
  4. Commit everything, then push it to the remote.
  5. Clone the repo on your servers (both production and staging) and set it up to deploy with git pull.

Branching strategy

For small teams, keep the workflow simple:

  • main: production-ready code.
  • staging: code tested on the staging server, not pushed to production yet.
  • feature/[name]: branches where developers do new work.

Feature branch -> PR into staging -> test -> merge into main -> deploy to production.

Secrets must not go in git

This bears repeating. Never commit:

  • Database credentials.
  • API keys for Discord, Steam and payment processors.
  • JWT secrets.
  • Private server IPs you don't want published.

Utilize environment variables, or store them in a separate .env file that git ignores. Never commit anything server-specific to public repos.

Deployment patterns

  • Git pull. Simple, and it works. Fine for smaller servers.
  • CI/CD. Push to main. A GitHub Action SSHs in, pulls and restarts. Great if you have a larger team.
  • Blue-green. Run two copies of everything, deploy to one and flip traffic over. Overkill for most GTA servers.

Common mistakes

  • Committing secrets. This occurs somewhere in the FiveM community every week. Change any leaked credentials ASAP.
  • Making edits directly on production. History is lost and production drifts from what's in git.
  • Force-pushing to main. History will be destroyed. Do not do this.
  • Working off one giant shared branch. Constant conflicts, code never reviewed.

Related reading

See our staging environment guide for the deployment workflow. Our server customization guide describes the content pipeline. The CPU bottleneck guide shows examples of scripts that do not scale well.

Frequently Asked Questions

Do I need git for my GTA 6 server scripts?

Yes, if you have more than one dev working on a server, or if you use custom scripts at all. Git gives you rollback, history, and backup. Without it, you're a weekend away from disaster.

Should my server repository be public or private?

Private, nearly all the time. Even if you open-source specific scripts, things like your server's config, database schema, and custom content generally shouldn't be public.

What should not go in my GTA 6 server git repo?

Database passwords, API keys, Discord bot tokens, JWT secrets. Use environment variables and commit a .env.example template to git instead of actual values.