Git solves the problem of Permission denied, please try again

read catalog

git pull

insert image description here
When uploading a project, git@xxx password: asks you to enter a password, and you find that no matter what you enter, there will be a problem of Permission denied, please try again. In fact, this is mainly because the SSH key of the project has not been added to your gitlab account.

1. Check the existence of the SSH Key.
If the id_rsa.pub or id_dsa.pub file exists, skip this step.

$ cd ~/.ssh # 查看用户根目录下.ssh文件夹
$ ls

2. Create an SSH Key.
When creating an ssh key, you will be prompted with a custom name and a password for pushing (not the git login password). It is generally recommended to skip it and press Enter three times. If the creation is successful, a small frame with a pattern will appear.

$ ssh-keygen -t rsa -C "[email protected]"

3. View SSH Key

Copy the public key content to gitLab and add it.

$ cat ~/.ssh/id_rsa.pub

4. Test SSH Key

$ ssh -T "[email protected]"

Among them, ssh keys click profile setting on this page, open profile setting, select the option of SSH key, as shown in the figure below

insert image description here
insert image description here

Guess you like

Origin blog.csdn.net/weiguang102/article/details/130104334