Open b-smiley opened 5 months ago
Its pretty simple, this is the line where the example code finds your ssh keys.
std::path::Path::new(&format!("{}/.ssh/id_rsa", env::var("HOME").unwrap())),
Basically its looking at ~/.ssh/id_rsa
while you're initializing ~/.ssh/authorized_keys
to have your ssh info.
Changing the format! section to format!("{}/.ssh/authorized_keys"...)
should do the trick.
Overview
The provided documentation for cloning with an SSH key closely follows the code below. I keep getting an authentication error even after trying most of the closed-issue solutions in this repository. I suspect that the error is coming from libssh2 dependency because when I trace the bug it appears to be erroring out in remote.c.
The SSH key does work with the environment because it clones properly when using git in terminal
Error
Failed to clone: failed to start SSH session: Unable to exchange encryption keys; class=Ssh (23) 😡
Code
Rust Code
Enviroment
docker-compose.yml
dockerfile
SSH key creation
ssh-keygen -t rsa -b 4096 -C "your_email@example.com"
I then put this key in the mount .ssh folder and put it in a file called authorized_keys.Final Remark
I am just trying to get a test environment for a server set up so I can test it with my actual application. If anyone has an alternative approach.