fix: make ya pkg ignore default remote name in user Git config

This commit is contained in:
sxyazi 2026-01-31 18:23:47 +08:00
parent a015d4a7ef
commit 68710cd9fc
No known key found for this signature in database

View file

@ -43,10 +43,17 @@ impl Git {
} }
async fn exec(f: impl FnOnce(&mut Command) -> &mut Command) -> Result<()> { async fn exec(f: impl FnOnce(&mut Command) -> &mut Command) -> Result<()> {
let status = f(Command::new("git").args(["-c", "advice.detachedHead=false"])) let status = f(Command::new("git").args([
.status() "-c",
.await "advice.detachedHead=false",
.context("Failed to execute `git` command")?; "-c",
"checkout.defaultRemote=origin",
"-c",
"clone.defaultRemoteName=origin",
]))
.status()
.await
.context("Failed to execute `git` command")?;
if !status.success() { if !status.success() {
bail!("`git` command failed: {status}"); bail!("`git` command failed: {status}");