Quick answer: Run sudo apt install git on Ubuntu/Debian or sudo dnf install git on AlmaLinux/Rocky, then set your identity with git config --global user.name and user.email. Use SSH keys to pull private repositories onto the server.

Overview

Git is how code gets onto your server cleanly: clone a repository, pull updates, roll back mistakes. Combined with SSH deploy keys, it beats copying files by hand every time.

Before you start

  • SSH access to your server.
  • A repository to clone (GitHub/GitLab/Bitbucket or self-hosted).

Step-by-step guide

  1. Install:
    # Ubuntu/Debian
    sudo apt -y install git
    # AlmaLinux/Rocky
    sudo dnf -y install git
    git --version
  2. Configure your identity (used in commit metadata):
    git config --global user.name "Your Name"
    git config --global user.email "[email protected]"
  3. For private repos, create a key on the server and add it to your Git host as a deploy key:
    ssh-keygen -t ed25519 -C "server-deploy-key"
    cat ~/.ssh/id_ed25519.pub
  4. Clone:
    git clone [email protected]:user/repo.git
    # or public repos over HTTPS:
    git clone https://github.com/user/repo.git
  5. Update later with git pull from inside the repo directory.

Common issues

  • Permission denied (publickey): the server's public key isn't added to the Git host — see how SSH keys work.
  • Password prompts on HTTPS: GitHub removed password auth — use SSH or a personal access token.
  • "dubious ownership" warning: the repo belongs to another user — git config --global --add safe.directory /path or fix ownership.

When to contact support

Git workflow questions are application-level; for server access problems, open a ticket.

Frequently asked questions

How do I clone a private repository onto my server?

Generate an SSH key on the server with ssh-keygen, add the public key to your Git host as a deploy key, then clone using the SSH URL such as [email protected]:user/repo.git.

Why does GitHub reject my password when cloning?

GitHub no longer accepts account passwords over HTTPS. Authenticate with an SSH key or create a personal access token and use it in place of the password.

Related articles

Ready to get started? Order a VPS at Cloud2Y →

Was this answer helpful? 0 Users Found This Useful (0 Votes)