How to set up a GitHub Actions self-hosted runner
By Pull This RepoPosted 5 min read
Short answer
To add a GitHub self-hosted runner, open your repository's Settings, then Actions, then Runners, and click New self-hosted runner. Pick the operating system and architecture, then run the commands GitHub shows on your machine: download the runner, run config.sh with the URL and token, then run.sh. Target it in a workflow with runs-on: self-hosted.
A GitHub self-hosted runner is a machine you own that runs GitHub Actions jobs instead of GitHub's cloud machines. GitHub's docs define it as "a system that you deploy and manage to execute jobs from GitHub Actions on GitHub." People set one up to build on hardware GitHub does not offer, such as a GPU box or an Apple Silicon Mac, to reach servers on a private network, or to keep heavy builds off their included cloud usage. This guide walks through the setup with the steps and commands from GitHub's own docs and the actions/runner repo, read on 22 November 2026.
What is a GitHub self-hosted runner?
The runner itself is a small application, open source under the MIT licence in the actions/runner repo (6,412 stars on 22 November 2026, latest release v2.338.2 from 26 October 2026). You install it on a machine, register it with a repository, organization or enterprise, and it waits for jobs. The machine can be physical, virtual, a container, on your own premises or in a cloud.
| GitHub-hosted runner | Self-hosted runner | |
|---|---|---|
| Who runs the machine | GitHub | You |
| Fresh machine each job | Yes | No; the docs say it does not need a clean instance per job |
| Hardware and OS choice | GitHub's images | Anything supported |
| Updates | GitHub | Runner app updates itself; you maintain the OS and tools |
| Cost | Draws on your plan's included usage, then billed | Free on GitHub's side; you pay for the machine |
What do you need first?
From GitHub's self-hosted runners reference:
- Linux (Ubuntu, Debian, Red Hat Enterprise Linux 8 or later, and others), Windows 10 or 11 64-bit or Windows Server 2016, 2019 or 2022, or macOS 11 Big Sur or later.
- x64, or ARM64, which the docs mark as in public preview.
- The machine "must be able to make outbound HTTPS connections over port 443," and needs at least 70 kilobits per second of upload and download.
- Permissions: for a personal repository you must be the owner; for an organization repository, an organization owner or someone with admin access. Adding a runner to a whole organization needs an organization owner.
How do you add a self-hosted runner to a repository?
- Open the repository on GitHub and click Settings. If you do not see it, it is under the More menu.
- In the left sidebar, click Actions, then Runners.
- Click New self-hosted runner.
- Pick the operating system image and architecture of your machine.
- GitHub now shows a block of commands with a registration token built in. The docs say to "run each shell command in the order shown." The token expires after one hour, so do this straight away.
For a Linux x64 machine, the download part published with release v2.338.2 is:
mkdir actions-runner && cd actions-runner
curl -O -L https://github.com/actions/runner/releases/download/v2.338.2/actions-runner-linux-x64-2.338.2.tar.gz
tar xzf ./actions-runner-linux-x64-2.338.2.tar.gzThen register and start it, using the URL and token from your settings page:
./config.sh --url https://github.com/OWNER/REPO --token YOUR_TOKEN
./run.shconfig.sh lets you name the runner and add custom labels as it registers. If it reports missing libraries, the actions/runner Linux prerequisites page says to run ./bin/installdependencies.sh. While run.sh is running, refresh the Runners page and the runner appears in the list.
On Windows, the release notes recommend a folder at the drive root, such as C:\actions-runner, to avoid service permission and long path problems, and the commands run in PowerShell.
Can you get the token with the GitHub CLI?
Yes. The registration token is also available from GitHub's REST API, so with the GitHub CLI installed you can request one from a terminal:
gh api -X POST repos/OWNER/REPO/actions/runners/registration-token --jq .tokenThat is handy when you script runner setup across several machines.
How do you run the runner as a service?
run.sh stops when you close the terminal. To keep it running across reboots, install it as a service. GitHub's docs give these commands, run from the runner folder after stopping it:
Linux (systemd):
sudo ./svc.sh install
sudo ./svc.sh start
sudo ./svc.sh status./svc.sh install USERNAME runs the service as a different user. sudo ./svc.sh stop and sudo ./svc.sh uninstall reverse it.
macOS: the same ./svc.sh install, start, status, stop and uninstall, without sudo.
Windows: the service is set up during configuration. If you skipped that, remove the runner and configure it again. Manage it in PowerShell:
Get-Service "actions.runner.*"
Start-Service "actions.runner.*"How do you use self-hosted runners in a workflow?
Point a job at your runner with runs-on. Every self-hosted runner gets three labels automatically: self-hosted, an operating system label (linux, windows or macOS) and an architecture label (x64, ARM or ARM64). Custom labels you added at setup work too:
name: build
on: push
jobs:
build:
runs-on: [self-hosted, linux, x64, gpu]
steps:
- uses: actions/checkout@v7
- run: ./build.shGitHub's docs say labels "operate cumulatively," so a runner must have all four of those labels to take this job. Plain runs-on: self-hosted sends the job to any of your self-hosted runners. If no matching runner is available, the job waits; the reference says it fails if it stays queued for more than 24 hours.
Can one runner serve several repositories?
Yes, at organization level. Go to the organization's Settings, then Actions, Runners, click New runner and then New self-hosted runner, and follow the same steps. GitHub says organization runners can process jobs for multiple repositories. Enterprise level runners exist too, which need GitHub Enterprise Cloud.
Are self-hosted runners safe on public repositories?
GitHub's answer is no: "We recommend that you only use self-hosted runners with private repositories." Anyone can fork a public repository, and the docs warn that forks "can potentially run dangerous code on your self-hosted runner machine" by opening a pull request with a changed workflow. A runner is a program on your machine that runs code from your repository, so treat it like giving that code a shell.
Practical steps that follow from that:
- Keep self-hosted runners on private repositories.
- Run them on a dedicated machine or virtual machine, not your daily laptop.
- Use ephemeral runners for untrusted or one-off jobs; GitHub's reference says the service de-registers an ephemeral runner after it processes one job.
- Give the runner's user account only the access it needs.
What does a self-hosted runner cost?
Nothing on GitHub's side. The Actions billing page, read on 22 November 2026, lists self-hosted runners as usage that "remains free independently and does not reduce the included compute usage." The concepts page adds that you pay for maintaining your runner machines. A spare PC at home costs power; a cloud server costs its monthly rate.
What is the catch?
You become the operations team. GitHub updates the runner application, but the operating system, build tools, disk space and security are on you, and because jobs reuse the same machine, leftovers from one build can affect the next. Public repositories are a real risk. If you want the whole stack on your own hardware, including the Git hosting, see our comparison of self-hosted Git servers. New to GitHub itself? Start with what GitHub is used for.
Pull it. Stash it.
Questions people ask
Are GitHub self-hosted runners free?
The runner software is. GitHub's Actions billing page, read on 22 November 2026, lists self-hosted runners as usage that remains free and does not reduce your included compute. You still pay for the machine itself: the hardware, power or cloud server the runner lives on.
Should I use a self-hosted runner on a public repository?
GitHub advises against it. Its docs recommend self-hosted runners only with private repositories, because forks of a public repository can potentially run dangerous code on your runner machine through a pull request. Public repositories also cannot use runners in a runner group by default.
How do I keep a self-hosted runner running after I log out?
Install it as a service. On Linux, stop the runner and run sudo ./svc.sh install, then sudo ./svc.sh start. On macOS the same commands run without sudo. On Windows, the service option is offered during configuration, and you manage it with Start-Service and Get-Service in PowerShell.
What labels does a self-hosted runner get?
Every runner gets self-hosted, an operating system label (linux, windows or macOS) and an architecture label (x64, ARM or ARM64). You can add custom labels such as gpu. A job's runs-on list must match all of a runner's listed labels for that runner to pick it up.
What happens if no runner is online?
The job waits in the queue. GitHub's reference says that if a job stays queued for more than 24 hours, it fails. Check that your runner appears online under Settings, Actions, Runners, and that the machine can reach GitHub over HTTPS.
Sources
- 1GitHub Docs: Adding self-hosted runners (read 2026-11-22)
- 2GitHub Docs: Self-hosted runners concepts (read 2026-11-22)
- 3GitHub Docs: Self-hosted runners reference (read 2026-11-22)
- 4GitHub Docs: Configuring the runner application as a service (read 2026-11-22)
- 5GitHub Docs: Using self-hosted runners in a workflow (read 2026-11-22)
- 6GitHub Docs: GitHub Actions billing (read 2026-11-22)
- 7actions/runner
More repos like this
Get tomorrow's repo in your feed
One free, open source repo a day as a short video, shown working, with the catch named. Pull it. Stash it.
