# 用 Github Desktop 連結 Gitlab ###### tags: `環境` 參考來源:[How to use Github Desktop with Gitlab](https://itnext.io/how-to-use-github-desktop-with-gitlab-cd4d2de3d104) --- ## 處理步驟: ### 步驟1、環境確認: 1. 下載[GitHub Desktop](https://desktop.github.com/) 1. 前往 [Gitlab](https://gitlab.com/) 的設定頁面 ![設定進入頁面](https://i.imgur.com/MCl8UdG.png) ### 步驟2、取得帳號憑證: 1. 進入存取憑證 ![進入存取憑證](https://i.imgur.com/doRsuHN.png) 2. 生成存取憑證 ![設置憑證](https://i.imgur.com/ol2FfnT.png) 3. 複製存取憑證,存好,等下使用。 ![複製存取憑證](https://i.imgur.com/VXYq0O6.jpg) ### 步驟3: 1. 進入 repository 選取 clone https,並複製連結。 ![複製HTTP連結](https://i.imgur.com/fKaEQAh.jpg) 2. 開啟 GitHub Desktop,選取 clone repository ![選取 clone repository](https://i.imgur.com/zgG4xgG.png) 3. 選 URL,貼上從 gitlab 複製的 https 連結,並選好目的資料夾。 ![輸入資料](https://i.imgur.com/etV21vY.jpg) 輸入完後點 clone 4. 跳出認證失敗視窗,輸入登入「gitlab 的帳號與『步驟2 取得的憑證』」 ![認證失敗視窗](https://i.imgur.com/3GmN3cN.jpg) * 補充,與文章相異處: - 文章表示,username 是登入的 e-mail 或等等。 - 文章表示,密碼則是上面的登入憑證。 - 但是在測試時,用原本的登入帳密就過了,密碼亦可使用登入憑證。 - 但如果開「二步驟認證 (2FA)」會無法用帳密登入 - 只能用 username 配合上面的登入憑證就可以 > v. While cloning, it would pop up a modal titled authentication failed, you would then be required to put in your username and password. > > N/B: Your username is mostly your email address or whatever username you used to access your gitlab organization or repo. > > vi. Then your password would be the personal access token we created before, so head over to wherever you may have stored it and paste it. 5. 如果成功,會看到平常的樣子 ![成功](https://i.imgur.com/8ySgy2D.jpg)