標籤:ras lan 執行 協議 power use win 導致 erp
1. 步驟1.首先現在電腦端安裝好git,window端請安裝Git for Windows,Linux端請自行網上查詢2.先核對下電腦上是已經有ssh配置
#Git Bash on Windows / GNU/Linux / macOS / PowerShell:cat ~/.ssh/id_rsa.pub
3.若沒有,則需要產生ssh的公開金鑰私密金鑰Git Bash on Windows / GNU/Linux / macOS:
#請先切換目錄到 ~/.ssh/下#如果不切換,當儲存的檔案名稱是自訂時,會產生在當前的目錄下。ssh-keygen -t rsa -C [email protected] -b 4096#提示是否使用新的檔案名稱Enter file in which to save the key (~/.ssh/id_rsa):#如果不輸入新的檔案名稱,則產生id_rsa檔案。#請輸入你的gitlab帳號的登入密碼Enter passphrase (empty for no passphrase):Enter same passphrase again:
4. 複製公開金鑰到GitLab中的SSH Keys中Windows Command Line:
type %userprofile%\.ssh\id_rsa.pub | clip
Git Bash on Windows / Windows PowerShell:
cat ~/.ssh/id_rsa.pub | clip
如果提示clip沒安裝,則只要‘ |’ 的前半部分命令,然後複製出文本,或者直接到指定位置用文本開啟。5.配置config檔案在~/.ssh/下面建立一個檔案
cd ~/.ssh/mkdir config
config內容如下:
# GitLab.com serverHost gitlabHostname gitlab.comUser gitIdentityFile ~/.ssh/id_rsa
6.測試SSH是否已配置好
ssh -T [email protected]#如果已經配置好,則會提示Welcome to GitLab, Your GitLab NickName!
7.Clone項目到本地如果gitlab上已經有項目,則直接clone一份代碼到本地
git clone [email protected]:username/yourProject.git #(SSH方式)#如果用SSH clone失敗了,請嘗試用HTTPS clonegit clone https://gitlab.com/username/yourProject.git #(HTTPS方式)
如果gitlab還沒有項目,可以建立一個,再clone空項目下來。
按理說github設定SSH原理是完全相同的。
2. 可能出現的情況
1.在windows系統下用git bash,在第6步驟,一直提示逾時串連,不管是ssh還是https協議。(暫時不知道怎麼解決) 2.在ubuntu系統,根據官方的協助文檔,缺少第5步驟,會導致底6步驟執行會顯示沒許可權訪問。
3. 參考資料https://gitlab.com/help/ssh/READMEGitlab配置ssh串連
Gitlab的SSH配置(linux和window雙版本)