🐧
Linux

Installing and Using Git on a Linux Server

πŸ“… 20 October 2026 ✏️ 20 October 2026 ⏱ 4 min leestijd

Learn step by step how to install Git on your Linux server and use the key commands for version control and deployment.

Git is the most widely used version control system and essential if you want to manage or deploy code on a Linux server. In this article, you’ll install Git on the most common Linux distributions, configure your user details, and learn the basic commands to clone repositories, commit changes, and push code to your server.

What is Git and why use it on a server

Git is a version control system that tracks code changes, allows collaboration with others, and makes it easy to revert to a previous version. On a Linux server, Git is often used to deploy code directly from a repository, without manually uploading files via FTP. This makes managing websites and applications more organized and less error-prone.

Local codeGit repositoryLinux server

Installing Git on Linux

Git installation varies slightly by distribution, but is ready within a few minutes on any system. Below are the most commonly used commands.

1

Ubuntu or Debian

Run sudo apt update, followed by sudo apt install git -y. Verify the installation with git --version.

2

AlmaLinux, Rocky Linux, or CentOS

Use sudo dnf install git -y. On older systems, sudo yum install git -y also works.

3

Check the version

Run git --version to confirm the installation succeeded and check which version is active.

4

Check SSH access

Make sure you can log in to your server via SSH, so you can run Git commands directly on the server.

πŸ’‘ Tip: if you don’t have root access on your server, ask your hosting provider whether Git is already available or have them install it for you.

Configuring Git and basic commands

After installation, first set up your user details so commits are linked to the right person:

git config --global user.name "Your name"
git config --global user.email "[email protected]"

Then you can get started with the most important commands:

  • git clone [url] – copies an existing repository to your server
  • git status – shows which files have been changed
  • git add . – adds changes to the next commit
  • git commit -m "description" – records changes with an explanation
  • git pull – fetches the latest changes from the remote repository
  • git push – sends local changes to the remote repository
  • git log – shows the commit history

If you work with a private repository on GitHub or GitLab, you’ll usually need an SSH key or personal access token to clone and push.

Using Git for deployment

Many developers use Git not only for version control, but also to deploy changes automatically or manually to a live server. A common approach is to clone the repository directly into your domain’s webroot and then run git pull for every update. For larger projects, you can automate this with a post-receive hook or a CI/CD pipeline.

If you manage multiple websites or client projects, pay close attention to file permissions: the web server user must have read access to the files coming in via Git. If you use Plesk, you’ll find an overview of repositories under Git integration per domain, and you can link deployment actions to a specific folder, without having to work manually via SSH.

If you run into conflicts when merging changes, use git diff to review differences before completing a merge. Also always make sure you have an up-to-date backup before making major changes to a production environment.

If you’d rather not manage a server yourself but still want to use Git integration, check out web hosting with the Plesk panel, or read in the knowledge base how to smoothly switch to Tandata while keeping your existing projects.

Frequently Asked Questions

Do I need root access to install Git?

Yes, you usually need sudo or root access for the installation itself. Once installed, you can use Git without extra permissions within your own folders.

Can I use Git without SSH access?

No, you need SSH access to run Git commands directly on the server. Some control panels offer a graphical Git integration as an alternative.

What’s the difference between git pull and git fetch?

Git fetch retrieves changes without merging them with your local files, while git pull fetches and merges the changes immediately.

Can I manage multiple Git repositories on one server?

Yes, you can clone as many repositories as you want, as long as there’s enough storage space available on your server.

Is Git the same as GitHub?

No, Git is the version control software, while GitHub is a platform that hosts Git repositories online and offers extra collaboration features.

Conclusion

Installing Git on a Linux server is a matter of one or two commands, depending on your distribution. With the right configuration and basic commands, you can manage your code clearly and deploy changes quickly and safely to your server.

View web hosting β†’

Was dit artikel nuttig?