gitlab 配置ssh

一. 生成ssh密鑰對

  1. 查看本地已經(jīng)有 密鑰對
    ls ~/.ssh/ 查看是否生成一下兩個(gè)文件
./.ssh/
├── id_rsa
└── id_rsa.pub
  1. 生成密鑰對
    ssh-kengen
 ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa):
Created directory '/root/.ssh'.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /root/.ssh/id_rsa.
Your public key has been saved in /root/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:xBhmVIxxxxxxxxxxxxxxxxxxxxxxxx root@gitlab.example.com
The key's randomart image is:
+---[RSA 2048]----+
|        ..E*.    |
|       ..+o.+    |
|        o.+. o   |
|  . o  . B  . o  |
|   + +. S =  . . |
|    *+++ = +     |
|   *.o* . o      |
|   .+*.o         |
|   .==*.         |
+----[SHA256]-----+

cat ~/.ssh/id_rsa.pub 待會(huì)將該文件內(nèi)容添加到gitlab 的ssh key中

二.登錄到gitlab,為自己的賬戶添加SSH key

  1. 點(diǎn)擊Settings,進(jìn)入用戶設(shè)置


    image.png
  2. 進(jìn)入到SSH keys 設(shè)置
    image.png

    3.添加ssh key
    cat ~/.ssh/id_rsa.pub 里面的內(nèi)容粘貼進(jìn)去,Title可以用自定義的也可以是默認(rèn)的的。然后點(diǎn)擊Add key
image.png

點(diǎn)擊添加后,重新刷新一下頁面就能看到


image.png
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容