devcontainers, Docker, SSH credentials, Windows: git-clone fails

Answered

Hi everybody,

currently I'm struggling with devcontainers in a Windows 11 environment.

MS Windows 11
IntelliJ: 2026.1
Rancher Desktop as Docker environment

I created a devcontainer.json file and would like to use “Create dev container and clone sources” to create a devcontainer as mounting the sources is terribly slow. The sources are in my git repository and in my native Windows IntelliJ it is no problem to access the repository via SSH.

My problem is this does not work in the devcontainer. I have multiple SSH key files which are configured in SSH config file. 

Adding the correct ssh key (not! id_rsa) to the ssh-agent like described here does not work and the git clone fails. Mounting my Windows .ssh folder is no solution as when mounted a wrong owner and wrong file permissions are set and these can't be changed after the mount via terminal.

Is there any way to configure the ssh-agent to pick a specific SSH key for a specifig URL? Any ideas?

Thank you in advance,
Christoph


 

0
10 comments

Hi Christoph, 

Thanks for raising this. Would you mind sharing your IDE logs as described here + a screenshot of the UI error you're facing? You can upload them to our server and share the ID with us.

Best regards,
Petru
 

0

Hi Petru,

I created the screenshots and got the relevant parts from the logs, you can find them in 
Upload id: 2026_05_18_4RNpMNk5RmWrULuHCbAdAe (files: Screenshot 2026-05-18 212828.png and 3 more)

The problem is the SSH key used for the git clone (last screenshot, ***/.ssh/id_rsa) is the wrong one, I have several configured.

Best regards,
Christoph

0

Hello, Info. Unfortunately, the pieces of the logs you shared are not relevant to the problem; please share the full log (or only the idea.log file from the archive) as requested before.

Also, could you please share a non-sensitive part (or structure) of your SSH config? On my side, Git clone with SSH key works without issues, so I believe something may be special in the configuration you use. 

0

Hi,

this is my SSH config in Windows:

Host git.flexguse.de
    HostName git.flexguse.de
    User xxxxxx
    IdentityFile ~/.ssh/gitea_ed25519

and inside the .ssh folder I have the files

docker_master_rsa
gitea_ed25519
id_rsa
config

I'll provide the complete log this evening.

0

Thank you for the update; since there is nothing unusual in your config file, I'm waiting for the IDE logs. 

0

idea.log is now available in Upload id: 2026_05_22_GzrMaaxdASE3GpMpJUSPAj (file: idea.log).

0

Additionally the devcontainer build-log:
 

Preparing helper container for git clone…
Initializing remote agent…
Computing target platform… done
Copying remote agent binary… done
Cloning into '.'...
yes
Warning: Permanently added '[git.flexguse.de]:2222' (RSA) to the list of known hosts.
git@git.flexguse.de: Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
Performing ssh-add -k command… finished with non-zero exit code 1.

The username for the git repository is not “git”, if this helps.

0

Info, thank you for sharing the logs. Unfortunately, I wasn't able to find any additional relevant information about the problem you encountered there.
On my side, I had a similar problem with the Git clone via the SSH URL using the non-GitHub repository, which resolved itself after rebooting the laptop. Could you please double-check if rebooting helps? Also, please check if the SSH key was correctly added to the SSH agent via the `ssh-add -l` command.

0

Hi Olga,

I managed to get it running. Originally I did not use the id_rsa SSH certificate for git. After changing and using id_rsa for Git IntelliJ was able to create a new devcontainer and clone the sources into it.

Rebooting my system did not help ;)

Regards,
Christoph

0

Info, thank you for the update; glad the problem is solved now!

Please let me know if you have any further questions or requests; I'll be happy to help.

0

Please sign in to leave a comment.