Reputation: 2922
I wanted to try and use git
in my regular Windows prompt instead of in Git Bash. Simply for the reason that I could then use the terminal that IntelliJ provides. I figured it to be a 1 minute fix but I guess not.
When I try to git pull origin <branch>
I get the following error message:
C:\Users\Username\Documents\Bitbucket\java-project>git pull
Could not create directory '/c/Username/.ssh'.
The authenticity of host 'bitbucket.org (131.103.20.167)' can't be established.
RSA key fingerprint is 12:8c:1b:f2:6d:14:6b:5c:3b:ec:aa:46:46:xy:7c:40.
Are you sure you want to continue connecting (yes/no)? yes
Failed to add the host to the list of known hosts (/c/Username/.ssh/known_hosts).
Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
I have set the permissions on the existing .ssh
folder such that all Users have full access, administrators and SYSTEM. So that should be okay.
I also tried to run the prompt as Administrator to see if that was the issue but that's not the case either.
What I do notice now is that it says: Could not create directory '/c/Username/.ssh'.
. However, my .ssh
directory is located at C:\Users\Username\.ssh
. I might need to change my configuration then.
Git version: 1.9.0.msysgit.0 Windows version: Windows 8.1
Upvotes: 8
Views: 24091
Reputation: 61
Open Git Bash console.
Perform the command below to enable read and write; chmod 776 your local path here/known_hosts
Upvotes: 0
Reputation: 62906
First of all, tested with msysgit 1.9.2, when one selects to make just git
command available from cmd.exe
during installation (where other choices are, make it avaiable only under git bash, or make all MSYS commands available under cmd.exe), git clone
works from cmd.exe prompt.
The ssh client uses HOME
environment variable to find .ssh/
directory, but git should take care of all the ugly details. You should not have HOME
defined in your normal Windows environment, so if echo %HOME%
in cmd.exe prompt prints a path, edit the OS environment variables and remove HOME
.
If that does not solve it, uninstalling and installing latest version might help.
Finally, you have paths like C:UsersUsername
, it probably means you're missing quotes somewhere. In git bash, try these two commands to see:
echo C:\Users\Username
echo 'C:\Users\Username'
Upvotes: 5
Reputation: 1329652
Make sure you type your cmd session the git-cmd.bat
which comes with every Git For Windows msysgit release.
That will set your HOME
to %USERPROFILE%
, which should be C:\Users\Username
.
But make sure you didn't have an environment variable HOME
already defined with an incorrect value: unset it if that is the case.
Upvotes: 1