* Fix git credential saving and improve host matching

- Fix token masking bug in GitCredentialDialog that corrupted tokens on edit
- Add tokenEdited state to preserve original token when not modified
- Default new credential host to https://github.com
- Add normalizeHostname helper for consistent host comparison
- Improve credential lookup logging to show configured vs requested hosts
- Remove overly permissive fuzzy matching that could leak tokens

* Make OpenCode reload non-fatal when saving git credentials

Settings are now saved to database even if the OpenCode server reload
fails. The reload error is returned separately so the UI can inform
the user that credentials were saved but the server needs a manual
restart.

* Fix git fetch using credentials in silent mode

Previously, silent mode (used for UI fetch operations) would skip
credential lookup entirely and return empty, causing auth failures.
Now credentials are always looked up via IPC regardless of silent mode.
This commit is contained in:
Chris Scott authored and GitHub committed 2026-01-25 00:38:47 -05:00
1 parent 3a8d4993c1
commit 24aa4f6c83
6 files changed
+80 -39

No files matched your search

+2 -7
View File
@@ -33,13 +33,8 @@ function main(argv: string[]): void {
const ipcHandlePath = process.env['VSCODE_GIT_IPC_HANDLE']
console.error(`[askpass-main] pid=${process.pid}, output=${output}, askpassType=${askpassType}, ipcHandlePath=${ipcHandlePath}, argv=${argv.join(', ')}`)
if (process.env['VSCODE_GIT_FETCH_SILENT']) {
console.error('[askpass-main] Silent fetch mode, returning empty')
fs.writeFileSync(output, '\n')
return process.exit(0)
}
const isSilent = !!process.env['VSCODE_GIT_FETCH_SILENT']
console.error(`[askpass-main] pid=${process.pid}, output=${output}, askpassType=${askpassType}, ipcHandlePath=${ipcHandlePath}, silent=${isSilent}, argv=${argv.join(', ')}`)
if (!ipcHandlePath) {
console.error('[askpass-main] No IPC handle, returning empty')