> For the complete documentation index, see [llms.txt](https://docs.gta.clothing/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.gta.clothing/share-and-sync/sync-a-project-with-github.md).

# Sync a Project with GitHub

Keep a saved project in a private GitHub repository, with every save as a commit

DCT can keep your project in a private GitHub repository. Every save becomes a commit with a message that lists what changed, and commits from other people arrive in your open project while you work. Each collaborator works in their own clone.

GitHub sync works with any DCT license. GitHub permissions, repository storage and Git LFS allowances still apply. A DCT team invitation does not grant access to a GitHub repository.

## Start the setup

1. Open and save the project, then choose **Project > Share and sync this project…** (or press **Ctrl+K** and paste `>Share and sync`).
2. Under **Keep this project in sync**, choose **GitHub**. The setup has three steps: **Connect GitHub**, **Choose repository** and **Upload**.
3. If DCT needs Git first, it shows **Install Git for DCT**. Choose it. DCT downloads its own copy of Git and Git LFS, and nothing else on your PC changes. An existing Git installation with Git LFS also works.

## Connect your GitHub account

1. Under **Connect your GitHub account**, choose **Connect GitHub account**. DCT shows a short code in large letters.
2. Choose **Copy code and open GitHub**, or **Copy** the code and open GitHub yourself.
3. On GitHub, paste the code and approve Durty Cloth Tool. DCT never sees your password.
4. Return to DCT. It continues by itself once you approve. If the code expired or the request was declined, choose **Get a new code**.

<figure><img src="https://2130288373-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FRsXe3tqSiAvM8iKYjngE%2Fuploads%2Fgit-blob-b4f5d20da5edce00d9ea40a660819350206c0535%2Fgithub-connect-code.png?alt=media" alt="Step 1 of 3, Connect GitHub, on This project: Connect your GitHub account with 1. Copy this code, the code blurred, Copy, 2. Open GitHub, paste the code and approve Durty Cloth Tool, Copy code and open GitHub, Waiting for your approval on GitHub, The code works for 15 more minutes, and Cancel."><figcaption><p>Copy the code, then approve Durty Cloth Tool on GitHub.</p></figcaption></figure>

Afterwards DCT shows **Signed in to GitHub as @yourname** with **Sign out**. Signing out stops your Git projects from syncing until you connect GitHub again; nothing is deleted.

## Allow DCT to use your repositories

The first time, DCT shows **Allow DCT to use your repositories**:

1. Choose **Open GitHub**. GitHub opens the install page of the [Durty Cloth Tool GitHub App](https://github.com/apps/durty-cloth-tool-project-sync/installations/new).
2. Install it on your account and choose **All repositories**. DCT can then set up each new project in one click.
3. Return to DCT. It continues by itself once GitHub confirms. If it does not, choose **Check now**.

**Only select repositories** also works. DCT then asks you to allow each repository it needs, as described below. An organization may need its owner to approve the installation; see [GitHub's guide to installing an App](https://docs.github.com/en/apps/using-github-apps/installing-a-github-app-from-a-third-party).

<figure><img src="https://2130288373-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FRsXe3tqSiAvM8iKYjngE%2Fuploads%2Fgit-blob-fc6d393205f957f3c84ff030da7ed3f7ba1e0bbf%2Fgithub-app-install.png?alt=media" alt="GitHub&#x27;s page to install Durty Cloth Tool Project Sync on an account whose name is blurred, with All repositories selected, Only select repositories, the permissions Read access to metadata and Read and write access to code and repository creation, and Install and Cancel."><figcaption><p>Choose All repositories, then Install.</p></figcaption></figure>

## Choose the repository

Under **Where should the project go?**, choose one:

* **Create a new private repository**: enter a **Repository name**. DCT shows the account it is created on. Only you can see the repository until you invite people on GitHub. If you already have a repository with that name, choose **Use the existing one**. Then choose **Create repository and upload**.
* **Use a repository you already made**: choose an **empty** repository from the list. **Search repositories** narrows it. Then choose **Connect and upload**. To work on a repository that already contains a project, use [Clone a Project from Git](https://docs.gta.clothing/share-and-sync/clone-a-project-from-git.md) instead.

<figure><img src="https://2130288373-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FRsXe3tqSiAvM8iKYjngE%2Fuploads%2Fgit-blob-768568ba5d0412e34f9094e29a035b9ca872a125%2Fgithub-choose-repo.png?alt=media" alt="Step 2 of 3, Choose repository, on This project for GitHub: Signed in to GitHub as a blurred test account with Sign out, Where should the project go?, Create a new private repository selected with the repository name pier_tops, Use a repository you already made, and Create repository and upload."><figcaption><p>Choose where the project goes on GitHub.</p></figcaption></figure>

### When DCT asks for access to a repository

If you chose **Only select repositories** on GitHub, DCT shows **Allow access to** followed by the repository name:

1. Choose **Open GitHub**.
2. Add the repository to the ones Durty Cloth Tool may use and save.
3. Return to DCT. It continues by itself; choose **Check now** if it does not.

Choosing **All repositories** there means you won't be asked again.

<figure><img src="https://2130288373-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FRsXe3tqSiAvM8iKYjngE%2Fuploads%2Fgit-blob-8074e6497a695042f6d6e0ca8ce6fdc368eaec60%2Fgithub-allow-access.png?alt=media" alt="Step 2 of 3, Choose repository: Allow access to the test repository forge_studio_test with its account blurred, Open GitHub, the progress line, This continues by itself once GitHub confirms., Tip: choose All repositories there and you won&#x27;t be asked again., and Check now."><figcaption><p>DCT waits until you allow the repository on GitHub.</p></figcaption></figure>

## After the upload

**This project** now shows **Synced with GitHub** with the repository and branch, the current status, **Open on GitHub** and **Pause sync**. **Stop syncing** sits at the bottom. Every save becomes a commit with a message that lists what changed, so the repository's history reads like a log of your work.

<figure><img src="https://2130288373-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FRsXe3tqSiAvM8iKYjngE%2Fuploads%2Fgit-blob-ca1b1bce57935f5e898b03b09dd15759c30e36df%2Fgithub-synced.png?alt=media" alt="This project showing Synced with GitHub with Up to date, Last synced just now, the test repository pier_tops on branch main, Open on GitHub, Pause sync, and Stop syncing at the bottom."><figcaption><p>A project that syncs with GitHub.</p></figcaption></figure>

<figure><img src="https://2130288373-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FRsXe3tqSiAvM8iKYjngE%2Fuploads%2Fgit-blob-32dec8530a6a89f494466f5e896565abd6d7d2c2%2Fgithub-commits.png?alt=media" alt="The commit list of the private test repository pier_tops on GitHub, with commits such as Update Female 4 Sunset Denim Shirt in &#x27;pier_tops&#x27; and Add &#x27;pier_tops&#x27; to Git; the account details are blurred."><figcaption><p>Every save becomes a commit that names what changed.</p></figcaption></figure>

## Invite collaborators

Each collaborator needs their own access to the repository on GitHub. For a personal repository, use **Settings > Collaborators > Add people** and have them accept the invitation. See [GitHub's collaborator guide](https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/repository-access-and-collaboration/inviting-collaborators-to-a-personal-repository).

The Durty Cloth Tool GitHub App must also be allowed for that repository on the account that owns it. **All repositories** covers it. Collaborators then join with [Clone a Project from Git](https://docs.gta.clothing/share-and-sync/clone-a-project-from-git.md), not by connecting a different project to the same repository.

## If the project is already in a Git repository

When the project folder is already a Git repository, **This project** shows it at the top:

* **Turn on automatic sync** when the repository already has an online remote.
* **Publish to GitHub** when the repository only exists on this PC. Its history is kept.
* **Install Git for DCT** when Git is needed first.

## If GitHub access fails

The status on **This project** names the problem and offers a fix:

* **Sign in to GitHub:** choose **Connect GitHub account** and approve the new code.
* **GitHub access needed:** choose **Allow access on GitHub** and add the repository. DCT continues on its own.
* **Repository not empty:** the repository already has other history. Choose an empty repository, or clone that repository into a new folder.
* **Paused: branch changed** or **Needs Git attention:** something changed outside DCT. Use your Git client in the project folder, then resume.

[Project Sync](https://docs.gta.clothing/share-and-sync/project-sync.md#status-and-problems) lists every status. DCT team roles do not replace your GitHub repository permission or the App's access. For GitLab, Bitbucket or an SSH address, follow [Sync with Another Git Host](https://docs.gta.clothing/share-and-sync/sync-with-another-git-host.md).

Cloud and Git are separate ways to sync. To switch, choose **Stop syncing** first, then set up the other one.
