Skip to content

Wiki sync: stop treating git's stderr as fatal#5

Merged
recklessop merged 1 commit into
mainfrom
claude/pensive-easley-4abcbe
May 8, 2026
Merged

Wiki sync: stop treating git's stderr as fatal#5
recklessop merged 1 commit into
mainfrom
claude/pensive-easley-4abcbe

Conversation

@recklessop
Copy link
Copy Markdown
Owner

Wiki sync: stop treating git's stderr warnings as fatal

PowerShell with $ErrorActionPreference = 'Stop' escalates ANY native-command stderr output to a script-terminating error. git writes plenty of informational lines to stderr (CRLF nags, remote: Processed N references, Switched to branch X), which made the sync script abort partway through every run when nothing was actually wrong.

Three fixes:

  1. Switch to ErrorActionPreference = 'Continue' and check $LASTEXITCODE after each git call.
  2. Drain stderr on each git call with 2>&1 | Out-Null.
  3. Disable core.autocrlf and core.safecrlf in the throwaway wiki clone so git stops complaining about line endings.

Verified end-to-end: Gitea wiki now has 12 pages + sidebar pushed cleanly.

Generated with Claude Code

PowerShell with ErrorActionPreference=Stop escalates ANY native-command
stderr output to a script-terminating error. git writes plenty of
informational lines to stderr (CRLF nags, "remote: Processed N
references", "Switched to branch X"), which made the sync script
abort partway through every run when actually nothing was wrong.

Three fixes:

1. Switch to ErrorActionPreference=Continue and check $LASTEXITCODE
   manually after each git call.
2. Drain stderr on each git invocation with `2>&1 | Out-Null`.
3. Disable core.autocrlf and core.safecrlf in the throwaway wiki
   clone so git stops complaining about line endings.

Verified end-to-end against Gitea: 12 pages + sidebar pushed cleanly.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@recklessop recklessop merged commit 9fcff26 into main May 8, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant