--Environment - Debian GNU/Linux 10 (buster) - git version 2.23.0
Reference: Register Deploy keys in the GitHub repository and access without password | CodeLab
If you set a passphrase when creating the key, you will be required to enter the passphrase every time you fetch the repository as well as clone it, so we will not set the passphrase this time. *. Please set and cancel the passphrase at your own risk.
# 1.Create an RSA key pair.
$ ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa): <<<< Enter(Where to create the key)
Created directory '/root/.ssh'.
Enter passphrase (empty for no passphrase): <<<< Enter(Passphrase)
Enter same passphrase again: <<<< Enter(Passphrase)
...abridgement...
# 2.View and copy the public key.
$ cat /root/.ssh/id_rsa.pub
ssh-rsa AAAAB3NzaC1yc2EAAAA...
Specify the repository as [email protected]:username/repository.git
.
If you make a mistake, it will look like fatal: repository'[email protected]/hoge/fuga.git' does not exist.
# 1.Create a directory for the repository clone destination.
$ mkdir git
# 2.Change to the directory you created.
$ cd git/
# 3.Clone the repository.
$ git clone [email protected]:ponta/hoge.git
Cloning into bare repository 'hoge.git'...
...abridgement...
Recommended Posts