How to Fix Gitea Actions Runner Connection Error
In this tutorial, you'll learn about How to Fix Gitea Actions Runner Connection Error. We cover key concepts, practical examples, and best practices.
Gitea Actions runner shows Failed to register runner: Post "https://git.example.com/api/v1/...": dial tcp: connection refused or jobs stay in the pending queue forever.
The Problem
$ ./act_runner register
INFO Registering runner, arch=amd64, os=linux, version=0.1.0
DEBU Run register...
ERRO Failed to register runner: Post "https://git.example.com/api/v1/..." dial tcp: connection refused
Step-by-Step Fix
Step 1: Verify the Gitea instance can reach itself
curl -v https://git.example.com/api/v1/version
Expected:
{"version":"1.21.0"}
Step 2: Get the runner registration token
From the Gitea UI: Settings > Actions > Runners > Create Runner. Copy the token.
Step 3: Register the runner manually
./act_runner register \
--instance https://git.example.com \
--token YOUR_TOKEN \
--name docker-runner \
--labels ubuntu-latest:docker://node:20-bullseye
Step 4: Check runner status
./act_runner daemon
Step 5: Verify jobs are picked up
Run a test workflow:
on: [push]
jobs:
test:
runs-on: ubuntu-latest
steps:
- run: echo "Hello, Gitea Actions!"
Prevention Tips
- Use
dockerorhostrunner mode to match your workflow needs - Register multiple runners for concurrent job execution
- Set
GRITEA_RUNNER_TOKENas an environment variable in CI provisioning scripts
Common Mistakes with actions runner
- Using
returnto exit a function early instead of wrapping a pure value in the monad - Mixing let bindings with <- bindings in do notation, producing type errors
- Overlapping type class instances that cause GHC to reject the program with ambiguous dispatch errors
These mistakes appear frequently in real-world GITEA code. DodaTech's contributors have identified these patterns through analysis of open-source projects and production systems.
Practice Exercise
Write a pure function that safely divides two integers using Maybe, then test it with edge cases like division by zero and negative numbers.
This exercise reinforces the concepts covered in this guide. Try implementing it before checking online solutions.
FAQ
Built by the developers of DodaTech
Doda Browser, DodaZIP & Durga Antivirus Pro