简体   繁体   中英

Git clone without username and password

I'd like to use git clone https://... without using username and password , it doesn't work on my server.

Command : sudo git clone https://gitlab.com/****/****.git

Issue : They ask me the username and password.

Using SSH, they ask me the passphrase, and I don't want to input something after git clone .

Any ideas?

Edit #1

Command : sudo ssh-keygen -p -P "myoldpassword" -n "" -f /root/.ssh/id_rsa.pub

Result :

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

Using SSH, they ask me the passphrase, and I don't want to input something after git clone

To remove the passphrase from your ssh key you need to run

$ ssh-keygen -p [-P old_passphrase] [-N new_passphrase] [-f keyfile]

There is also the option of using ssh-agent, which can cache the passphrase for some time.

Just use chmod 400 /root/.ssh/id_rsa.pub . This will make your key read-only, and will allow you to use it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM