Intellij IDEA git trying to add to system's known hosts and not %USERPROFILE%
Answered
Yesterday 2024.1.4 community crash hard in so far as I had to restart my vm without gracefully shutting down.
Today when I try to update my git repository it's trying to add to systemprofile/.ssh and not my %USERPROFILE% .ssh folder.
How is this controlled?
Please sign in to leave a comment.
git command line works without issue and correctly recreates %USERPROFILE%/.ssh/known_hosts if I remove it.
However Intellij is only seeing systemprofile and not userprofile when using git.
Even just trying to clone the repo produces the same errors.
also git from the IntelliJ terminal also fails with the same errors.
A reinstall of the Intellij addressed my issue but it would be nice to understand the underlying dependency that caused the above behavior. Since if all Intellij is doing is calling git then you'd expect the same behavior outside of the IntelliJ but that wasn't the case this time.
Hi,
Can you please provide more details about your setup?
“Today when I try to update my git repository it's trying to add to systemprofile/.ssh and not my %USERPROFILE% .ssh folder.” - How exactly did you test this?
The IDE should not temper with these files, and it should inherit them from the default terminal.
I was updating my repository both in the IDE (bottom right) as well as doing git pull from IDE's terminal.
With both tests Intelli was seeing that the host key verification with the remote was failing and therefore it needed to insert a new key in known_hosts but it was only trying to do so in the systemprofile's known_hosts file and not the userprofiles. The systemprofile is non-writable location hence the pull failed.
When doing the above doing a git pull outside the IDE was working without issue and was able to add the entry to known_hosts in my userprofile.
Upon reinstalling the IDE this issue went away.
So what about the reinstallation was able to make IntelliU consider known_hosts in my userprofile again?
Quite odd, it should respect behave the same as using the terminal.
What was the error you have received? How did you notice systemprofile is used?
Are you using remote dev?
Are you able to share logs?
I could see that when it errors it says that it’s testing to add the key to the known_host file in system profile directory ie. C:\Program Files….. \.ssh and not C:\Users…. \.ssh
It did this with in the IDE and the IDEs terminal but did not when using cmd outside of the IDE.
https://www.reddit.com/r/IntelliJIDEA/comments/1hwp2x8/intellij_community_not_seeing_userprofile_when/ - similar report
We do not know why this occurs. IDE has no control over this part. Do you perhaps have 2 different git executables?
I don't believe there's two git executables. It was just using the one it auto detected.
Unfortunately, we have no other guess why this might happen.
Did it occur again?
As I reinstalled Intellij IDEA again it has not occurred again yet.