---
tags: Rapi Document Chinese
---
# 支援 Github和 GitLab的遠端同步功能
支援同步github與gitlab的功能,經由設定github或gitlab的access token和帳號名稱下,可以直接經由Rapi UI進行與remote repository的Pull和Push。
---
## 註冊github和gitlab的access token
需要您的授權去取得repository,因此請您先註冊access token,請參考[github](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token)和[gitlab](https://docs.gitlab.com/ee/user/profile/personal_access_tokens.html)的官網
```
💡 注意:若您使用是Github,請勾選『repo』選項。
若您是使用GitLab,請勾選『api』,『read_reposotiory』和『write_repository』的功能。
```
---
## 在Rapi中設定帳號資訊
接下來,請在Rapi輸入您的使用者相關資訊。
### 步驟1 : 開啟您的Option頁面
請到Rapi的設定頁面,在Basic設定中,點下GitHub Account Settings或GitLab Account Settings。

再經由Basic setting中最下方的兩個選項,GitHub Account Setting或GitLab Account Setting開啟設定表單。

### 步驟2 : 設定您的資訊
根據您註冊的access token,請輸入您的使用者名稱和access token。

```
💡 若您有需要同步到您自行架設的GitLab,在GitLab設定中的Domain name
可以輸入您伺服器的domain name
```

---
## 取得遠端檔案功能
### 步驟1 : 開啟表單
成功設定好了access token之後,即可以在Rapi UI中的Sidebar的Test Suite 按下右鍵,選擇經由open suite選擇github或gitlab開啟Suite。

### 步驟2 : 選擇您需要取得的Test Suite
接下來,您可以使用表單選擇您需要的Test Suite使用。
1. Repository select代表您需要取得資料的repository,
2. Branch代表當前repository的分支位置,
3. Directory代表您得資料夾或檔案位置並按下Pull按鈕後
選擇完畢之後,即可以在Rapi中開啟Suite。
```
💡 表單只會出現.json和.html的檔案。
```

---
## 同步遠端檔案功能
### 步驟1 : 開啟表單
成功設定好了access token之後,即可以在Rapi UI中的Sidebar的任一個Suite按下右鍵,選擇經由.json或是.html格式儲存Suite於github或gitlab。

### 步驟2 : 選擇您需要儲存的Repository Path
接下來,您可以使用表單選擇您需要儲存於哪個repository中的路徑。
1. Repository select代表您想要儲存資料的repository,
2. Branch代表當前repository的分支位置,
3. Directory代表您想要儲存資料的資料夾。
4. Commit Message代表您此次同步儲存的git commit message。
選擇完畢之後,按下Push按鈕後,即可以儲存您的Suite於遠端的repository。
