# Source Control

## Source Control (GitHub) - User Manual

This guide provides step-by-step instructions for managing source control in **cloud-based VS Code (code-server)** using **GitHub**.

***

### Prerequisites

Before using GitHub with Monaca, you must first [**link your Monaca account to GitHub**](https://monaca.mobi/vcs)**.**

***

### 1. Committing File Changes

1. Open the **Source Control** panel by clicking the **Git** icon in the **Activity Bar** (left sidebar).
2. Click **Initialize Repository**.

<figure><img src="/files/GAGIHNFYdOPTMVH0y3QF" alt="" width="563"><figcaption></figcaption></figure>

3. Enter a commit message (e.g., `"init"`) and click **Commit**.

<figure><img src="/files/mUriWaS7ehgy1o2K0ppU" alt="" width="350"><figcaption></figcaption></figure>

4. In the confirmation dialog, click **Yes** to commit all changes.

<figure><img src="/files/BEaekHW1UjmY8EafYvyk" alt="" width="563"><figcaption></figcaption></figure>

***

### 2. Publishing to a New GitHub Repository

1. Click **Publish Branch** to push the committed changes.

<figure><img src="/files/yvJi7XJLEbbtG8TvUYBn" alt="" width="351"><figcaption></figcaption></figure>

2. If this is your first time using GitHub in the IDE, a sign-in dialog will appear. Click **Allow** to proceed.

<figure><img src="/files/xDJXm5JYUFf5kGZznO5I" alt="" width="563"><figcaption></figcaption></figure>

3. Copy the authentication code and click **Copy & Continue to GitHub**.

<figure><img src="/files/jJlCttlZjR0nwnCcXxeg" alt="" width="563"><figcaption></figcaption></figure>

4. A new tab will open. Review your GitHub account details and click **Continue**.

<figure><img src="/files/tR7LYa68gmuo3p7swPj5" alt="" width="563"><figcaption></figcaption></figure>

5. Paste the copied authentication code and click **Continue**.

<figure><img src="/files/nBGIPvTQmMEijB6fa9WF" alt="" width="563"><figcaption></figcaption></figure>

6. Review your GitHub account details and click **Authorize Monaca** to grant access.

<figure><img src="/files/2k8RtUo7Jdlr2Q2h0yh3" alt="" width="369"><figcaption></figcaption></figure>

7. Depending on your GitHub authentication settings, a different sign-in page may appear. Choose your preferred authentication method.

<figure><img src="/files/QO8f6VKGi96UhkfJpmz0" alt="" width="375"><figcaption></figcaption></figure>

8. If using **GitHub Mobile**, open the GitHub app on your phone and enter the verification code.

<figure><img src="/files/srbU00KJHOxjCQ9OuSGn" alt="" width="375"><figcaption></figcaption></figure>

8. Once authentication is successful, you will see a confirmation page. You can close this tab and return to the IDE.

<figure><img src="/files/SVhSdIGJuoY9JJJZH1ER" alt="" width="563"><figcaption></figcaption></figure>

10. The default repository name will be set to the **Project ID**.

<figure><img src="/files/2fbp2cc6o5q6URh9KLrK" alt="" width="563"><figcaption></figcaption></figure>

11. You can keep the default name or change it. Select whether to create a **private** or **public** repository.

<figure><img src="/files/hJ8Zeaq5ET9vv6gcgokM" alt="" width="563"><figcaption></figcaption></figure>

12. Once the repository is successfully created, you will see confirmation messages.
    * Click **Open on GitHub** to view the repository.
    * Click **Yes** to enable periodic syncing with the remote repository.

<figure><img src="/files/0IBgLrX7ftHAYI69Nk25" alt="" width="563"><figcaption></figcaption></figure>

***

### 3. Publishing to an Existing GitHub Repository

Once the GitHub repository is linked to your project, you will not be required to authenticate again.

1. Make modifications to your project.

<figure><img src="/files/xMt8NMFvNbz1Mp4wI6w6" alt="" width="563"><figcaption></figcaption></figure>

2. Enter a commit message describing the changes and click **Commit**.

<figure><img src="/files/7jJPsWGqh1kRuCdi8vuU" alt="" width="227"><figcaption></figcaption></figure>

3. Click **Yes** to confirm or **Always** to avoid this confirmation dialog in the future.

<figure><img src="/files/BOOVwq7aMOv4WEzmbWsT" alt="" width="386"><figcaption></figcaption></figure>

4. Click **Sync Changes** to push the latest commits to the remote repository.

<figure><img src="/files/T6qYgFfAPvAMYi4BTOIm" alt="" width="225"><figcaption></figcaption></figure>

5. Click **OK** to confirm or **OK, Don't Show Again** to disable this confirmation for future syncs.

<figure><img src="/files/RDtZk2Q3bZ1DRkTMe1Ru" alt="" width="386"><figcaption></figcaption></figure>

6. Once the changes are successfully pushed, the commit list will be cleared, and the sync button will be disabled.

<figure><img src="/files/csDEJzND3vtiYf6LQUng" alt="" width="224"><figcaption></figcaption></figure>

***

### 4. Additional Git Operations

Additional Git operations such as **Pull, Stash, Branch Management, and more** can be accessed by clicking the **menu (hamburger icon)** in the **Source Control** panel.

<figure><img src="/files/433b3ypGnA5u9jT7dFcr" alt="" width="563"><figcaption></figcaption></figure>

***

### Notes

* Ensure you have **write access** to the repository before committing changes.
* Always **pull the latest changes** before making updates to prevent merge conflicts.
* GitHub authentication steps may vary depending on user settings.
* Some features may be restricted for **free-plan users**.
* **Private repositories** are not available for **free-plan users**.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://en.docs.monaca.io/products_guide/new-monaca-cloud-ide/source-control.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
