Pure-rust Git Client
```rust use rustgit::*; use coolssh::createed25519keypair;
let githubaccountid = "john.doe@gmail.com"; let (opensshencodedpubkey, keypair) = createed25519keypair(githubaccountid);
println!("{}", opensshencodedpubkey);
// Add this public key to authorized_keys
on your server
// -> https://github.com/settings/keys
let remote = Remote::new("github.com:22", "git", "NathanRoyer/rustgit.git", &keypair);
let mut repo = Repository::new(); let the_branch = "main";
// we don't need the full history let clone_depth = Some(1);
// this will clone the branch via SSH repo.clone(remote, Reference::Branch(thebranch), clonedepth).unwrap();
// enough with this library repo.stage("src/lib.rs", None).unwrap();
// let's be nice with each other repo.stage("content.txt", Some(("Hello World!".into(), FileType::RegularFile))).unwrap(); let newhead = repo.commit( "I said hello to the world", ("John Doe", githubaccountid), ("John Doe", githubaccount_id), None, ).unwrap();
// this will update the branch via SSH repo.push(remote, &[(thebranch, newhead)], false).unwrap(); ```
shallow
option.report-status
and thin-pack
options.fn Repository::log() -> impl Iterator<Item = Commit>
Feel free to submit pull requests for these.