diff --git a/src/sdk.rs b/src/sdk.rs index 9c83621..6cd9317 100644 --- a/src/sdk.rs +++ b/src/sdk.rs @@ -11,6 +11,7 @@ use serde::Deserialize; use std::env; use std::fs; use std::path::{Path, PathBuf}; +use std::process::Command; #[cfg(target_os = "macos")] use crate::launchctl; @@ -282,13 +283,26 @@ fn fetch_repo_info(repo: &git2::Repository) -> git2::MergeAnalysis { true }); - remote - .fetch( - &["main"], - Some(FetchOptions::new().remote_callbacks(callbacks)), - None, - ) - .nice_unwrap("Could not fetch latest update"); + let res = remote.fetch( + &["main"], + Some(FetchOptions::new().remote_callbacks(callbacks)), + None, + ); + if res.as_ref().is_err_and(|e| { + e.message() + .contains("authentication required but no callback set") + }) { + // Setting the authentication callback is kinda jank, just call the git process lmao + Command::new("git") + .args(&["fetch", "origin", "main"]) + .current_dir(Config::sdk_path()) + .spawn() + .nice_unwrap("Could not fetch latest update") + .wait() + .nice_unwrap("Could not fetch latest update"); + } else { + res.nice_unwrap("Could not fetch latest update"); + } // Check if can fast-forward let fetch_head = repo.find_reference("FETCH_HEAD").unwrap(); @@ -414,7 +428,6 @@ fn switch_to_tag(config: &mut Config, repo: &Repository) { } fn install_binaries(config: &mut Config, platform: Option) { - update(config, None); let release_tag: String; let target_dir: PathBuf; if config.sdk_nightly {