没有用户名和密码的Git克隆
问题描述:
我想使用git clone https://...
而不使用username
和password
,它不起作用在我的服务器上。没有用户名和密码的Git克隆
命令:sudo git clone https://gitlab.com/****/****.git
问题:他们问我的用户名和密码。
使用SSH,他们问我密码,我不想在git clone
之后输入内容。
任何想法?
编辑#1
命令:sudo ssh-keygen -p -P "myoldpassword" -n "" -f /root/.ssh/id_rsa.pub
结果:
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ WARNING: UNPROTECTED PRIVATE KEY FILE! @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Permissions 0644 for '/root/.ssh/id_rsa.pub' are too open.
It is required that your private key files are NOT accessible by others.
This private key will be ignored.
bad permissions: ignore key: /root/.ssh/id_rsa.pub
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ WARNING: UNPROTECTED PRIVATE KEY FILE! @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Permissions 0644 for '/root/.ssh/id_rsa.pub' are too open.
It is required that your private key files are NOT accessible by others.
This private key will be ignored.
bad permissions: ignore key: /root/.ssh/id_rsa.pub
Bad passphrase.
答
使用SSH,他们问我密码,我不想输入后的东西git clone
要从SSH密钥删除密码,你需要运行
$ ssh-keygen -p [-P old_passphrase] [-N new_passphrase] [-f keyfile]
也有使用ssh-剂,可以缓存一段时间的密码的选项。
+0
它不起作用,请编辑#1。 – tonymx227
答
只需使用chmod 400 /root/.ssh/id_rsa.pub
。这将使您的密钥为只读,并允许您使用它。
如果它是一个私有的或其他访问受限制的存储库,除了配置SSH访问之外,您还可以做其他事情。你有这个功能吗? – Makoto
是的,这是一个私人存储库。是的,我启用了SSH,但有一个密码,我不希望他们... – tonymx227