pub async fn clone(
url: &str,
target: &Path,
options: Option<CloneOptions>,
) -> Git2DBResult<Repository>Expand description
Clone a repository
§Examples
ⓘ
// Simple clone with defaults
git2db::ops::clone("https://github.com/user/repo.git", "./repo", None).await?;
// Clone with custom options
use git2db::clone_options::CloneOptions;
use git2db::callback_config::{CallbackConfigBuilder, ProgressConfig};
use git2db::auth::AuthStrategy;
let options = CloneOptions::builder()
.callback_config(
CallbackConfigBuilder::new()
.auth(AuthStrategy::SshAgent { username: Some("git".to_owned()) })
.progress(ProgressConfig::Stdout)
.build()
)
.shallow(true)
.depth(1)
.build();
git2db::ops::clone("https://github.com/user/repo.git", "./repo", Some(options)).await?;