git 访问自建gitlab报错:Please make sure you have the correct access rights and the repository exists.

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/a15959255535/article/details/84822771

1.首先设置git身份的名字和邮箱:

    git config --global user.name "yourname"

    git config --global user.email“[email protected]"

2.删除.ssh文件夹(直接搜索该文件夹)下的known_hosts(手动删除即可,不需要git)

3.git 输入命令

    $ ssh-keygen -t rsa -C "[email protected]"(填你设置的邮箱地址)

    出现:

    Generating public/private rsa key pair.

    Enter file in which to save the key (/Users/your_user_directory/.ssh/id_rsa):

    直接回车

    系统会自动在.ssh文件夹下生成两个文件,id_rsa和id_rsa.pub,用记事本打开id_rsa.pub

    复制全部内容

4.打开gitlab,登陆你的账户,进入设置

5.git中输入命令:

    ssh -T [email protected]

    输入命令:yes

猜你喜欢

转载自blog.csdn.net/a15959255535/article/details/84822771