circleci: fix docs push auth (#914)

In commit 4f950bb60 we switched the publish workflow to use HTTPS and
changed CircleCI config accordingly. However, that wasn't working. The
error we get after merge to `master`, when we run the job, is: `The key
you are authenticating with has been marked as read only.`

The reason is that CircleCI configures SSH URL rewriting, which takes
precedence.

Fix by using git's `url.<base>.insteadOf` config to rewrite both HTTPS
and SSH URLs to use HTTPS with the GitHub token. This ensures the token
is used regardless of any SSH configuration.

---------

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Christian Schwarz
2026-02-06 00:32:59 +01:00
committed by GitHub
parent 4f950bb60a
commit 2aff1e45a4
+6 -3
View File
@@ -68,16 +68,19 @@ commands:
git config --global user.email "zreplbot@cschwarz.com" git config --global user.email "zreplbot@cschwarz.com"
git config --global user.name "zrepl-github-io-ci" git config --global user.name "zrepl-github-io-ci"
# Configure git to use the GitHub token for HTTPS authentication # Configure git to use the GitHub token for HTTPS authentication.
# The token is stored in the 'zrepl-github-io-deploy' context # The token is stored in the 'zrepl-github-io-deploy' context.
- when: - when:
condition: << parameters.push >> condition: << parameters.push >>
steps: steps:
- run: - run:
name: Configure git credential helper for GitHub token name: Configure git to use GitHub token for push
# GITHUB_PAGES_TOKEN is from the 'zrepl-github-io-deploy' context. # GITHUB_PAGES_TOKEN is from the 'zrepl-github-io-deploy' context.
# CircleCI's secret masking automatically redacts context variables in logs. # CircleCI's secret masking automatically redacts context variables in logs.
command: | command: |
# Unset CircleCI's SSH URL rewriting that checkout step configured
git config --global --unset-all url."ssh://git@github.com".insteadOf || true
# Set up credential helper with GitHub token
git config --global credential.helper store git config --global credential.helper store
echo "https://x-access-token:${GITHUB_PAGES_TOKEN}@github.com" > ~/.git-credentials echo "https://x-access-token:${GITHUB_PAGES_TOKEN}@github.com" > ~/.git-credentials
chmod 600 ~/.git-credentials chmod 600 ~/.git-credentials