Multi-Forge Remote Configuration
Configured GitLab and Gitea remotes for enterprise-linux-8021x repo, troubleshooting OAuth expiration and ssh-add issues.
Overview
| Field | Value |
|---|---|
Date |
2026-02-26 |
Duration |
~1 hour |
Systems |
GitHub, GitLab, Gitea, SSH agent |
Type |
Configuration |
Outcome |
Success |
Raw Log |
|
Objective
Add GitLab and Gitea remotes to an existing GitHub repo (enterprise-linux-8021x) following the multi-forge workflow documented in the runbooks.
Environment
# Starting state - only GitHub remote
$ git remote -v
origin git@github.com:EvanusModestus/enterprise-linux-802.1x.git (fetch)
origin git@github.com:EvanusModestus/enterprise-linux-802.1x.git (push)
Session Log
Phase 1: Get Repo Name from GitHub
$ REPO_NAME=$(gh repo view --json name -q '.name')
$ echo $REPO_NAME
enterprise-linux-802.1x
Used gh CLI to extract repo name programmatically for variable substitution.
Phase 2: Add Remotes
$ git remote add gitlab git@gitlab.com:EvanusModestus/${REPO_NAME}.git
$ git remote add gitea git@gitea:evanusmodestus/${REPO_NAME}.git
$ git remote -v
gitea git@gitea:evanusmodestus/enterprise-linux-802.1x.git (fetch)
gitea git@gitea:evanusmodestus/enterprise-linux-802.1x.git (push)
gitlab git@gitlab.com:EvanusModestus/enterprise-linux-802.1x.git (fetch)
gitlab git@gitlab.com:EvanusModestus/enterprise-linux-802.1x.git (push)
origin git@github.com:EvanusModestus/enterprise-linux-802.1x.git (fetch)
origin git@github.com:EvanusModestus/enterprise-linux-802.1x.git (push)
Phase 3: Create Repos on Forges
Gitea (Success):
$ tea repo create --name ${REPO_NAME} --private
# Created successfully
GitLab (OAuth Error):
$ glab repo create ${REPO_NAME} --private
ERROR: oauth2: "invalid_grant" "The provided authorization grant is invalid, expired..."
Phase 4: Fix glab OAuth
# Clear stale config
$ rm -rf ~/.config/glab-cli
# Re-authenticate
$ glab auth login
# Generated new PAT at GitLab with api + write_repository scopes
# Selected SSH as default protocol
# Retry - success
$ glab repo create ${REPO_NAME} --private
✓ Created project on GitLab: EvanusModestus / enterprise-linux-802.1x
Phase 5: Push to GitLab (SSH Key Issue)
$ git push gitlab main
Enter passphrase for key '/home/evanusmodestus/.ssh/id_ed25519_gitlab':
# Hangs after entering passphrase - no response
Diagnosis:
$ ssh-add -l
# GitLab key not listed - only github and vault keys loaded
$ ssh-keygen -y -f ~/.ssh/id_ed25519_gitlab
# Works - key and passphrase are valid
Fix - Explicit SSH_AUTH_SOCK:
$ SSH_AUTH_SOCK=/run/user/1000/ssh-agent.socket ssh-add ~/.ssh/id_ed25519_gitlab
Identity added: /home/evanusmodestus/.ssh/id_ed25519_gitlab (gitlab-arch-2026)
Phase 6: Push to All Forges
$ git push gitlab main
Enumerating objects: 88, done.
To gitlab.com:EvanusModestus/enterprise-linux-802.1x.git
* [new branch] main -> main
$ SSH_AUTH_SOCK=/run/user/1000/ssh-agent.socket ssh-add ~/.ssh/id_ed25519_gitea
Identity added: /home/evanusmodestus/.ssh/id_ed25519_gitea (gitea-arch-2026)
$ git push gitea main
To gitea:evanusmodestus/enterprise-linux-802.1x.git
* [new branch] main -> main
# Verify all synced
$ git remote | xargs -I {} git push {} main
Everything up-to-date
Everything up-to-date
Everything up-to-date
Root Cause
-
glab OAuth expired - Stored OAuth token in
~/.config/glab-cli/config.ymlwas no longer valid -
ssh-add hanging - Default
SSH_AUTH_SOCKwasn’t pointing to active agent; explicit socket path required
Resolution
-
Cleared glab config and re-authenticated with fresh PAT
-
Used explicit
SSH_AUTH_SOCK=/run/user/1000/ssh-agent.socketfor ssh-add -
Reorganized gopass GitLab entries:
v3/domains/d000/cloud/gitlab/evanusmodestus/{pat,ui,ui-otp}
Verification
$ git remote -v
gitea git@gitea:evanusmodestus/enterprise-linux-802.1x.git
gitlab git@gitlab.com:EvanusModestus/enterprise-linux-802.1x.git
origin git@github.com:EvanusModestus/enterprise-linux-802.1x.git
$ git remote | xargs -I {} git push {} main
Everything up-to-date (all 3)
Key Learnings
|