Fix Git sync when server-spawned Git needs SSH or credential-helper env#310
Open
ron-ulitsky wants to merge 2 commits into
Open
Fix Git sync when server-spawned Git needs SSH or credential-helper env#310ron-ulitsky wants to merge 2 commits into
ron-ulitsky wants to merge 2 commits into
Conversation
|
I could not sync this public PR into Patch application failed. The diff could not be applied cleanly. Try rebasing your PR on the latest base branch. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Git auto-sync now preserves the environment Git needs to authenticate when the server fetches or pushes a repository.
The server previously spawned Git with a small environment. That worked for token-backed HTTPS paths, but it broke remotes that depend on the user's home directory, SSH agent, or credential-helper environment. On Windows with an SSH remote,
ok syncand editor sync could fail with:The same
git fetchorgit pushworked from a terminal.This change keeps the user/home/session variables Git uses to locate SSH keys, SSH agents, and credential helpers. Commit author/committer overrides now merge into that preserved environment, so auto-save commits do not drop auth state before push.
GIT_TERMINAL_PROMPT=0and locale-stable stderr behavior stay unchanged.GIT_SSH_COMMANDstill does not pass through without simple-git's explicit unsafe opt-in.Testing:
npx -y bun@1.3.13 test packages/server/src/git-handle.test.tsgit diff --checkbun install --frozen-lockfilebun run lintManual verification on Windows:
ok sync --jsonsucceeds against an SSH remoteconsecutiveFailures: 0Notes:
bun run checkin a fresh Linux container hit existing upstream failures. The samesync-engine.test.tsfailures reproduce oninkeep/open-knowledge@main, so they are not introduced by this branch.