Reputation: 20222
I have a Bitbucket repo from which I am able to pull and push over HTTPS. Now, I'm trying to change HTTPS to SSH.
I have created an SSH key pair locally and I have added the public key to Bitbucket.
I have set the remote the following way:
git remote set-url origin [email protected]:7999/my-project.git
Then, when I do git pull
I am asking for my password three times and then I am denied permission:
Password:
Password:
Password:
Permission denied (publickey,gssapi-keyex,gssapi-with-mic,keyboard-interactive).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
I have two questions:
1.Why am I asked for my password if I'm using SSH?(and I haven't setup a password when creating the SSH key)
2.Why can I not connect to the server?
Upvotes: 0
Views: 707
Reputation: 2570
You havn't added your private key to the ssh.agent.exe
You havn't told us about your environment.
This is how I use ssh keys daily.
Set alias for where my ssh-add is located. This just makes everything pretty.
Set-Alias ssh-add "C:\Program Files\Git\usr\bin\ssh-add.exe"
Start the SSH Agent - which servers your ssh keys
Start-SshAgent -Quiet
Add your private key to your session
ssh-add C:\Users\username\.ssh\privateKey
Thats all.
I run those three commands in my $profile for powershell on windows.
Upvotes: 1
Reputation: 4920
Check the permission of your public key. Are you pulling it for first time, then your key needs to have certain privileges.
You have locate your key file where you have save in your windows.
To set, view, change, or remove permissions on files and folders
To set permissions for a group or user that does not appear in the Group or user names box, click Add. Type the name of the group or user you want to set permissions for, and then click OK.
To change or remove permissions from an existing group or user, click the name of the group or user.
Do one of the following: - To allow or deny a permission, in the Permissions for box, select the Allow or Deny check box.
For more information you can check this link to setup the rights: https://msdn.microsoft.com/en-us/library/bb727008.aspx
Upvotes: 0
Reputation: 177594
This URL is parsed as SSH over the standard port 22 with a path of 7999. Most likely the SSH server on port 22 does not authorize your git public key.
[user@]host.xz:path/to/repo.git/
Note that there's no room for a port.
The full SSH syntax is
ssh://[user@]host.xz[:port]/path/to/repo.git/
which should allow you to connect to the correct SSH port.
I often prefer to add an entry to my .ssh/config
specifying the server details:
Host git
HostName git.example.net
User git
Port 7999
PasswordAuthentication no
Then I can use the short syntax of git:path/to/repo.git/
.
Upvotes: 0