1. 程式人生 > >【Git】GitLab網頁管理方法

【Git】GitLab網頁管理方法

1、用瀏覽器開啟gitlab,登陸 2、建立工程,Namespace表示工程所屬,與後面生成的工程url息息相關,許可權分為3中,private表示僅namespace組內可用 internal表示所有登陸使用者可用,public表示所有人可以訪問。 3、專案設定,可以設定使用者許可權,新增使用者到專案等等 4、新增sshkey git倉庫之間的程式碼傳輸協議主要使用ssh協議,對於沒有密碼的git使用者,ssh不能直接登陸,這就需要ssh-keygen上傳公鑰,同時,即便是有密碼的使用者,上傳公鑰也可以減少操作步驟,無需輸入密碼。 若不使用公鑰,則每次都要配置密碼: $ git config --global user.name "test" $ git config --global user.email "[email protected]" a、查詢是否已存在ssh key pair 具體生成方法可以參考xxx.xxx.xxx.xxx/help/ssh/README 檢視是否已存在ssh key pair windows:type %userprofile%\.ssh\id_rsa.pub GNU/Linux / macOS / PowerShell: cat ~/.ssh/id_rsa.pub 若返回帶有ssh-rsa的字串,表示已經有ssh key pair了,將公鑰複製到gitlab即可 b、生成ssh key pair Windows:使用PuttyGen生成ssh key pair GNU/Linux / macOS: ssh-keygen -t rsa -C "GitLab" -b 4096 建議使用預設位置生成ssh key pair,否則需要修改.ssh/config檔案 不建議跳過密碼 c、將公鑰複製到gitlab macOS: pbcopy < ~/.ssh/id_rsa.pub GNU/Linux (requires the xclip package): xclip -sel clip < ~/.ssh/id_rsa.pub Windows Command Line: type %userprofile%\.ssh\id_rsa.pub | clip Windows PowerShell: cat ~/.ssh/id_rsa.pub | clip 當然,各種記事本也可以打開復制。 d、修改ssh keyname密碼 ssh-keygen -p e、非預設地址的ssh配置 # GitLab.com server Host gitlab.com RSAAuthentication yes IdentityFile ~/.ssh/config/private-key-filename-01 # Private GitLab server Host gitlab.company.com RSAAuthentication yes IdentityFile ~/.ssh/config/private-key-filename windows下還可以使用GitBash工具來生成 cd ~/.ssh/    #若不存在可手動建立 ssh-keygen -t rsa -C "
[email protected]
" ssh-add 檔名   #新增金鑰到ssh 新增公鑰到gitlab