[Untitled] Clone remote warehouse, git clone problem solution

Since the warehouse on my side is a private warehouse, there is a problem when cloning, and there is nothing. I checked it briefly, and it said to use another way, that is, use SSH, because the link to clone the private warehouse starts with git@, so I want to try it with SSH.
Step 1: View the list of SSH keys:

ls -al ~/.ssh

This will list all '~/.ssh' files, and if there is an SSH key, you can see the id_rsa and id_rsa.pub files, which are the private and public keys respectively.
Step 2: If you don’t have a key file (I don’t currently have one), you need to generate a new SSH key. Enter the following command to execute:

ssh-keygen -t rsa -b 4096 -C "[email protected]"

Replace "[email protected]" with your own gitee registered email address.
Step 3: Then set the file address and enter the password:
the following questions will appear, you can directly enter to skip (I skipped directly, the default address is selected, and no password is set)

enter file in which to save the key
enter same passphrase again

After the completion, the key is generated, and then you can view the generated key.
Step 4: View the key and copy it:

cat ~/.ssh/id_rsa.pub

At this time, the generated key will appear, usually starting with ssh-rsa, and ending with your registered email address (the email address is not counted as the key content). Step 5:
Add public key content to gitee:
Next is on gitee To add a key, select Personal Settings, select SSH Public Key Add in the list on the left, enter
insert image description here
the title and public key content, and it will be added successfully.
insert image description here
Then enter the command git clone git@... at this time to clone the contents of the remote warehouse.

Thank you for watching, I can be regarded as a record, to give myself a long memory.

Guess you like

Origin blog.csdn.net/weixin_43148375/article/details/130722338