Changed paths to match dragonfly laptop and disable push temporarily
This commit is contained in:
parent
f1e025e059
commit
b4db53cb9b
24
src/git.rs
24
src/git.rs
|
|
@ -66,19 +66,19 @@ pub fn backup_changes(repo_path: &Path) -> Result<(), Box<dyn std::error::Error>
|
|||
&[&parent_commit],
|
||||
)?;
|
||||
|
||||
// Set up remote push with credentials callback
|
||||
let mut callbacks = RemoteCallbacks::new();
|
||||
callbacks.credentials(move |_url, username, _allowed_types| {
|
||||
let user = username.unwrap_or("git");
|
||||
let token = get_git_token();
|
||||
Cred::userpass_plaintext(user, &token)
|
||||
});
|
||||
// // Set up remote push with credentials callback
|
||||
// let mut callbacks = RemoteCallbacks::new();
|
||||
// callbacks.credentials(move |_url, username, _allowed_types| {
|
||||
// let user = username.unwrap_or("git");
|
||||
// let token = get_git_token();
|
||||
// Cred::userpass_plaintext(user, &token)
|
||||
// });
|
||||
|
||||
// Push changes
|
||||
let mut push_options = PushOptions::new();
|
||||
push_options.remote_callbacks(callbacks);
|
||||
let mut remote = repo.find_remote("origin")?;
|
||||
remote.push(&["refs/heads/main"], Some(&mut push_options))?;
|
||||
// // Push changes
|
||||
// let mut push_options = PushOptions::new();
|
||||
// push_options.remote_callbacks(callbacks);
|
||||
// let mut remote = repo.find_remote("origin")?;
|
||||
// remote.push(&["refs/heads/main"], Some(&mut push_options))?;
|
||||
|
||||
println!("Changes committed and pushed successfully.");
|
||||
Ok(())
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ mod filesync;
|
|||
mod git;
|
||||
|
||||
const PROTECT_PREFIX: &str = ".git"; // only at first directory level
|
||||
const SOURCE_VAULT: &str = "D:\\Cloud\\Syncthing\\obsidian-vault"; // syncthing vault folder
|
||||
const SOURCE_VAULT: &str = "C:\\Users\\robin\\Obsidian"; // syncthing vault folder
|
||||
const REPO_VAULT: &str =
|
||||
"C:\\Users\\robin\\AppData\\Roaming\\obsidian-git-backup\\obsidian-vault-clone"; // git repo folder
|
||||
const GIT_COMMIT_DELAY_AFTER_FILE_CHANGE: Duration = Duration::from_secs(5 * 60); // 5 min
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user