# Git

## Overview

This interface allows users to manage and synchronize their application code repositories directly within the ClusterWare Console.

<figure><img src="https://4059189904-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FZ1eKMkHVNnzaESuDceBu%2Fuploads%2Fkq2QtXrU684z7Oc5YvTu%2FScreenshot%202024-05-29%20at%209.55.46%E2%80%AFAM.png?alt=media&#x26;token=be2ce3fa-871c-4ffc-85c9-f005714d8756" alt=""><figcaption></figcaption></figure>

## Key Sections

### **Repository URL**

The URL of the Git repository for the application. The repository URL is set in the cluster settings and is used primarily for Git clone operation upon initialization of the application on the server.

### **Status**

Indicates if the working directory is clean.&#x20;

* <mark style="color:green;">**Clean**</mark>**:** The working directory doesn't include any untracked changes in files.&#x20;
* <mark style="color:yellow;">**Not clean**</mark>**:** There are differences between the latest commit in local repository and your filesystem. It may happen when installing dependencies alters the `package.json` file or when your application modifies files within the repository at runtime.

{% hint style="info" %}
Keeping the working directory clean ensures that builds are reproducible. It allows the build process to reliably generate the same output from the same commit. By not storing state in the working directory, developers ensure that every checkout of the repository is consistent and free of environment-specific data.&#x20;
{% endhint %}

To restore the repository to the initial state use the **Clean** button.

<figure><img src="https://4059189904-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FZ1eKMkHVNnzaESuDceBu%2Fuploads%2FsUL2vhecMqCbYxEYmL0u%2FScreenshot%202024-05-29%20at%207.13.30%E2%80%AFPM.png?alt=media&#x26;token=3b8ecc98-27ab-4712-afe5-25050fe37478" alt="" width="333"><figcaption></figcaption></figure>

### **Current Branch**

Displays the current branch checked out in the local repository.&#x20;

#### **Options**

* **Change branch**: Click on the current branch dropdown and select a different branch.
* **Pull**: Click on the **Pull** button to update your local repository with latest changes in the remote repository. Git pull modifies the local working directory.

<figure><img src="https://4059189904-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FZ1eKMkHVNnzaESuDceBu%2Fuploads%2F2Ty08ioT4PS1Ps24TAYG%2FScreenshot%202024-05-29%20at%207.21.23%E2%80%AFPM.png?alt=media&#x26;token=7d2863da-ab9f-4e17-85d0-11ab1850a703" alt="" width="563"><figcaption></figcaption></figure>

### **Local Branches**

Lists the local branches available in the repository. The latest commit hash is shown along with the most recent commit message.

### **Remote Branches**

Shows the remote branches  and   with the same commit hash and message is displayed.

#### Options

* **Fetch:** Allows to fetch the latest updates from the remote repository. Git fetch does not modify local working directory.

## Sync Actions

* **Status:** Syncs information displayed in all sections of this tab: the current Git status, local branches and remote branches.

## Initializing new repository (Cloning)

If ClusterWare detects that the directory specified in the application config is not a Git repository, it asks the user to initialize it.

{% tabs %}
{% tab title="SSH Clone" %}
The following steps work for **public** and **private** repositories.&#x20;

1. Open your repository settings in a separate browser tab and allow list the SSH key provided in **Public Key** section to read the repository data.
2. Click **Clone** to initialize the local repository and pull latest changes from the default remote branch
   {% endtab %}

{% tab title="HTTPS Clone" %}
The following steps work for **public** repositories not requiring authentication to read the repository data.

1. Click **Clone** to initialize the local repository and pull latest changes from the default remote branch
   {% endtab %}
   {% endtabs %}

<figure><img src="https://4059189904-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FZ1eKMkHVNnzaESuDceBu%2Fuploads%2F4uaXkjGQOGGlRpBeSXfR%2Fgit-clone.webp?alt=media&#x26;token=4b3fd16a-95b8-422f-b772-61af0239e8a3" alt=""><figcaption></figcaption></figure>
