0

When attempting to Fetch from within IntelliJ or Clone using Check out from Version Control > Git I get this error:

Fetch failed

Could not create directory '/c/MyCompany/web-app/%HOMEDRIVE%%HOMEPATH%/.ssh'.

fatal: Could not read from remote repository.

In the Version Control console, the error reads:

Could not create directory '/c/MyCompany/web-app/%HOMEDRIVE%%HOMEPATH%/.ssh'. percent_expand: unknown key %H

fatal: Could not read from remote repository.

Please make sure you have the correct access rights and the repository exists.

I'm not sure why it's attempting to create any directory at all when Fetching, and I'm not sure why it's using my %HOME% path.

In the "Clone Repository" window, when attempting to Clone using Version Control, the Test is failing with "Repository test has failed".

When I use the GitBash to Fetch/Clone it works fine, but I want to use the tools in IntelliJ for easier use.

In the Version Control settings in IntelliJ I have SSH set to Native and IntelliJ is recognizing the Git executable.

It's possible it may have something to do with my .bashrc file which I created because I was previously getting an "Invalid public key" error using this fix: https://stackoverflow.com/a/26130250/5693073

My .bashrc file reads:

SSH_ENV=/c/Users/username/.ssh/environment

#start the ssh-agent

function start_agent {

echo "Initializing new SSH agent..."

# spawn ssh-agent

/usr/bin/ssh-agent | sed 's/^echo/#echo/' > "${SSH_ENV}"

echo succeeded

chmod 600 "${SSH_ENV}"

. "${SSH_ENV}" > /dev/null

/usr/bin/ssh-add

}

if [ -f "${SSH_ENV}" ]; then

. "${SSH_ENV}" > /dev/null

ps -ef | grep ${SSH_AGENT_PID} | grep ssh-agent$ > /dev/null || {

start_agent;

}

else

start_agent;

fi

One more thing to mention, when I check out an existing file using "Version Control: Log", the code checks out fine without any issues.

Any help is greatly appreciated, thank you!

4
  • What if you delete the .bashrc file and then try to clone in Intellij? And what's the version do you use for Interllij? Commented Nov 16, 2017 at 2:22
  • And please also make sure you have generated SSH Key on this local machine, and the SSH key has already added in your remote repo. Commented Nov 16, 2017 at 8:09
  • I deleted .bashrc and still receiving same error. SSH key is functioning fine for GitBash, so I doubt that's the issue. Intellij version is 2016.2.5 Commented Nov 21, 2017 at 20:38
  • In Intellij clone repository window, after input SSH URL, if you click test, does it can test connection successful? Commented Nov 23, 2017 at 8:51

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.