1. 程式人生 > >git 訪問自建gitlab報錯:Please make sure you have the correct access rights and the repository exists.

git 訪問自建gitlab報錯:Please make sure you have the correct access rights and the repository exists.

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