File tree Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -50,6 +50,20 @@ impl Credentials {
50
50
}
51
51
}
52
52
53
+ /// Write the SSH key to a temporary file and return the path. The file is
54
+ /// deleted once the returned path is dropped.
55
+ ///
56
+ /// This function can be used when running `git push` instead of using the
57
+ /// `git2` crate for pushing commits to remote git servers.
58
+ ///
59
+ /// Note: On Linux this function creates the temporary file in `/dev/shm` to
60
+ /// avoid writing it to disk.
61
+ ///
62
+ /// # Errors
63
+ ///
64
+ /// - If non-SSH credentials are use, `Err` is returned.
65
+ /// - If creation of the temporary file fails, `Err` is returned.
66
+ ///
53
67
pub fn write_temporary_ssh_key ( & self ) -> Result < tempfile:: TempPath , PerformError > {
54
68
let key = match self {
55
69
Credentials :: Ssh { key } => key,
You can’t perform that action at this time.
0 commit comments