Dimitri Kopriwa
Dimitri Kopriwa

Reputation: 14353

git ssh ask for a password with gitlab

I have recently installed on my Ubuntu dedicated a Gitlab server.

Webapp is working fine, I had no trouble during the installation (tested on VM before production environment)

I have uploded my ssh rsa private key from the web app on my account, and created a project, clone from another repository.

From my desktop environment, I have tried to git pull using ssh. First login, I had to accept the ssh fingerprint, then, until now server keep asking me to log in as git user, which has no password.

D:/drive/project> git pull [email protected]:me/project.git
[email protected]'s password:
Connection closed by 0.0.0.0
fatal: Could not read from remote repository.

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

D:\skydrive\artmoser>git pull
[email protected]'s password: [tried to type something]
Permission denied, please try again.
[email protected]'s password:
Permission denied, please try again.
[email protected]'s password:
^C

My ssh public and private key under windows is in C:\Users\Jack Bauer.ssh On the dedicated server I can see my key in /home/git/.ssh/authorized_keys

I have checked my chmod for user git :

drwx--x--x  7 git     git     4096 mai   31 05:06 git/
drwx------  2 git  git  4096 juin   1 03:27 git/.ssh/
-rw------- 1 git git  508 juin   1 02:53 git/.ssh/authorized_keys

What am i doing wrong ?

EDIT

After more research :

If I log in with git user with putty, I receive this error message server refused to allocate pty

If I try to do ssh [email protected], they ask for my passphrase, 3 times before git user password (which has none)

If I do a ssh tunnel with ssh [email protected] -Tvvv , i get this errror at the end of the log

debug1: Next authentication method: publickey
debug1: Trying private key: /home/me/.ssh/id_rsa
debug1: key_parse_private2: missing begin marker
debug1: key_parse_private_pem: PEM_read_PrivateKey failed
debug1: read PEM private key done: type <unknown>
Enter passphrase for key '/home/me/.ssh/id_rsa':

Upvotes: 2

Views: 3277

Answers (1)

VonC
VonC

Reputation: 1323503

the public key is on my computer, the private is on the server,

If you want to access a server with ssh, your client (here your Windows workstation) must have at least the private keys (and it is a good practice to keep the public keys together with their private keys counterparts).

C:\Users\Jack Bauer\.ssh\id_rsa.pub
C:\Users\Jack Bauer\.ssh\id_rsa

If your keys don't follow this default naming convention, you will need a C:\Users\Jack Bauer\.ssh\config file (as illustrated there)

Make sure you have the HOME environment variable set to C:\Users\Jack Bauer in your Windows shell when you are typing those command: that is the case if you launch the git-cmd.exe (which comes with any Git For Windows distribution)

Upvotes: 3

Related Questions