Black Friday: first month 50% off on monthly plans, or your first month free when you pay per quarter. Until Monday 30 November 23:59. See the plans Conditions
New customers: first month 50% off monthly plans, until 30 Nov
New here? Try a Minecraft server or Discord bot free for 24 hours. Try free
ServerSparkServerSpark

Knowledge base

Deploy a Discord bot from GitHub (public or private repository)

Link your GitHub repository in SparkPanel, use a personal access token for a private repository, and pull your newest commits on every start (discord.js and discord.py).

NVMe nodesNightly backupsOnline in minutes

Updated 30 November 2026

On a ServerSpark Discord bot hosting plan, SparkPanel can download your bot straight from a GitHub repository, public or private, and pull your newest commits every time the bot starts. This works for Node.js (discord.js) and Python (discord.py) bots.

Before you start

  • Your repository contains your bot code with package.json (Node.js) or requirements.txt (Python), so the packages can be installed automatically.
  • Your token is not in the repository. Put .env in your .gitignore; you add the token on the server later. See Environment variables and tokens for your Discord bot.
  • For a private repository: a GitHub personal access token with read access to that repository. On GitHub go to Settings, Developer settings, Personal access tokens. A fine-grained token limited to one repository with read-only Contents access is enough.

1. Fill in the GitHub fields

  1. Open your bot in SparkPanel and go to Settings, Bot settings.
  2. Unfold Code from GitHub (optional).
  3. GitHub repository link: for example https://github.com/name/my-bot.
  4. Branch: leave it empty for the default branch, or fill in another branch such as production.
  5. GitHub username and GitHub access token: only for a private repository. Use the access token, never your GitHub password.
  6. Switch off I upload my files myself (skip the GitHub download).
  7. Turn on Get the newest code from GitHub on every start if you want every restart to pull your latest commits.
  8. Click Save.

2. Download the code

The repository is downloaded when the bot is installed, and only into an empty folder. A new bot server already has starter files (a working /ping bot), so:

  1. Stop your bot.
  2. Under Files, select all files and delete them. Make a backup first under Backups if there is anything you want to keep.
  3. Go to Settings, Reinstall and reset and click Reinstall. The console shows the clone and the package install.

3. Add your token and start

  1. Under Files, create a file called .env with DISCORD_TOKEN=your-token (and any other variables your bot needs).
  2. Check Main file under Settings, Bot settings: index.js or app.py by default. Change it if your bot starts from another file, such as src/index.js or bot.py.
  3. Click Start. The console shows your bot logging in.

Updating your bot

With Get the newest code from GitHub on every start turned on, push to GitHub and restart the bot in SparkPanel: it pulls the new commits and installs any new packages before it starts. Your .env stays on the server, because it is not in the repository.

Changed files directly on the server? A pull can then stop with a Git error about local changes. Keep code changes in GitHub and only settings like .env on the server.

Common problems

  • Nothing was downloaded: the folder was not empty, or I upload my files myself was still on. Empty the folder and reinstall.
  • Authentication failed: the repository is private and the username or access token is missing, wrong or expired. Make a new token and save it in the GitHub fields.
  • Cannot find module or file: the main file is in a subfolder. Set Main file to the right path.
  • A TypeScript bot: build it to JavaScript first (for example with tsc) and set Main file to the built .js file.

Rather have us do it?

With the Setup service we put your bot online from GitHub for you, check the start file and packages and make sure it logs in; see Discord bot hosting. Running Python or Node.js? See Python Discord bot hosting or discord.js bot hosting.

Frequently asked questions

Can I host a Discord bot from a private GitHub repository? Yes. Fill in your GitHub username and a personal access token with read access next to the repository link under Settings, Bot settings, Code from GitHub.

Does my bot update itself when I push to GitHub? It pulls the newest code when it starts, if Get the newest code from GitHub on every start is on. Restart the bot after a push.

Where do I put my bot token? In a .env file on the server, never in the repository. The .env file stays when the bot pulls new code.

Can I use GitLab or another Git host? The fields are made for GitHub. A public repository link from another Git host may also work, because the bot clones it with Git, but we only describe GitHub here.