让ssh向gitlab请求密码

时间:2022-05-01 02:09:16

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

我最近在我的Ubuntu上安装了一个专门的Gitlab服务器。

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

Webapp运行良好,安装过程中没有出现问题(在生产环境之前在VM上测试)

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

我已经将我的ssh rsa私钥从我的帐户上的web应用程序上移开,并创建了一个项目,从另一个存储库克隆。

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.

在我的桌面环境中,我尝试使用ssh实现git提取。首先,我必须接受ssh指纹,然后,直到现在服务器一直要求我以git用户的身份登录,它没有密码。

D:/drive/project> git pull git@0.0.0.0:me/project.git
git@0.0.0.0'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
git@0.0.0.0's password: [tried to type something]
Permission denied, please try again.
git@0.0.0.0's password:
Permission denied, please try again.
git@0.0.0.0'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

我的ssh公共和私人密钥在windows C:\Users\Jack鲍尔。在专用服务器上,我可以在/home/git/.ssh/authorized_keys中看到我的密钥

I have checked my chmod for user git :

我检查了我的chmod是否有用户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

如果我用putty登录git用户,我收到这个错误消息服务器拒绝分配pty

If I try to do ssh git@0.0.0.0, they ask for my passphrase, 3 times before git user password (which has none)

如果我尝试使用ssh git@0.0.0.0.0,他们会询问我的密码,在git用户密码(没有密码)之前三次

If I do a ssh tunnel with ssh git@0.0.0.0 -Tvvv , i get this errror at the end of the log

如果我使用ssh git@0.0.0 -Tvvv进行ssh隧道,我将在日志的最后得到这个错误。

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':

1 个解决方案

#1


3  

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).

如果您希望使用ssh访问服务器,那么您的客户端(这里是您的Windows工作站)必须至少具有私钥(将公钥与私钥放在一起是一种很好的实践)。

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)

如果你的钥匙不遵循这个默认的命名约定,你需要一个C:\Users\Jack鲍尔\。ssh\配置文件(如图所示)

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)

确保你有家庭环境变量设置为C:\Users\Jack鲍尔在你的Windows shell当你输入命令:如果你启动git-cmd是这样。exe(与任何Git一起用于Windows发行版)

#1


3  

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).

如果您希望使用ssh访问服务器,那么您的客户端(这里是您的Windows工作站)必须至少具有私钥(将公钥与私钥放在一起是一种很好的实践)。

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)

如果你的钥匙不遵循这个默认的命名约定,你需要一个C:\Users\Jack鲍尔\。ssh\配置文件(如图所示)

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)

确保你有家庭环境变量设置为C:\Users\Jack鲍尔在你的Windows shell当你输入命令:如果你启动git-cmd是这样。exe(与任何Git一起用于Windows发行版)