Skip to content

Commit 1b5b379

Browse files
committed
Add auth callback when pulling
1 parent 5f13540 commit 1b5b379

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/verus.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1268,7 +1268,7 @@ pub mod install {
12681268
pub branch: Option<String>,
12691269
}
12701270

1271-
pub const VERUS_REPO: &str = "https://github.com/asterinas/verus.git";
1271+
pub const VERUS_REPO: &str = "https://git@github.com/asterinas/verus.git";
12721272

12731273
#[memoize]
12741274
pub fn tools_dir() -> PathBuf {
@@ -1483,7 +1483,11 @@ pub mod install {
14831483

14841484
// Find the remote and fetch the target branch
14851485
let mut remote = repo.find_remote("origin")?;
1486-
remote.fetch(&[target_branch], None, None)?;
1486+
let mut callbacks = git2::RemoteCallbacks::new();
1487+
callbacks.credentials(|_url, username_from_url, _allowed_types| { git2::Cred::ssh_key_from_agent(username_from_url.unwrap_or("git")) });
1488+
let mut fetch_opts = git2::FetchOptions::new();
1489+
fetch_opts.remote_callbacks(callbacks);
1490+
remote.fetch(&[target_branch], Some(&mut fetch_opts), None)?;
14871491

14881492
// Get the current branch
14891493
let head = repo.head()?;

0 commit comments

Comments
 (0)