Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
69 changes: 69 additions & 0 deletions content/doc/develop/git.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
---
type: docs
linkTitle: Git
title: Git on Clever Cloud
description: Learn how Git-based deployments work on Clever Cloud, including remotes, branches, shallow clones, monorepos, and private submodules

Check failure on line 5 in content/doc/develop/git.md

View workflow job for this annotation

GitHub Actions / vale

[vale] content/doc/develop/git.md#L5

[Vale.Spelling] Did you really mean 'monorepos'?
Raw output
{"message": "[Vale.Spelling] Did you really mean 'monorepos'?", "location": {"path": "content/doc/develop/git.md", "range": {"start": {"line": 5, "column": 113}}}, "severity": "ERROR"}
keywords:
- git
- deployment
- submodule
- commit
---
{{< hextra/hero-subtitle >}}
Clever Cloud uses Git-based deployments. This guide explains how to deploy with Git and handle common scenarios.
{{< /hextra/hero-subtitle >}}
## Git-based deployments

Clever Cloud deploys your application when you push to the Clever Git remote.

### Configure the Git remote

```bash
git remote add clever <your-git-deployment-url>
```

Find the deployment URL in the Console → your application → Information. See [Troubleshooting](/doc/find-help/troubleshooting/) for additional examples.

### Push branches

```bash
# If your local branch is main
git push clever main:master

# If your local branch is master
git push clever master
```

The Clever remote expects the branch named `master`. Map your local branch accordingly.

### Shallow clone vs full clone

By default, deployments perform a full clone. To speed up deployments, set `CC_GIT_FULL_CLONE=false` to use a shallow clone (`--depth 1`). See the [Environment variable reference](/doc/reference/reference-environment-variables/#variables-you-can-define).

### Monorepos (subdirectory deploy)

Check failure on line 43 in content/doc/develop/git.md

View workflow job for this annotation

GitHub Actions / vale

[vale] content/doc/develop/git.md#L43

[Vale.Spelling] Did you really mean 'Monorepos'?
Raw output
{"message": "[Vale.Spelling] Did you really mean 'Monorepos'?", "location": {"path": "content/doc/develop/git.md", "range": {"start": {"line": 43, "column": 5}}}, "severity": "ERROR"}

If your application lives in a subdirectory, set `APP_FOLDER` to that path (relative to the repository root). See the [Environment variable reference](/doc/reference/reference-environment-variables/#variables-you-can-define).

### Deploy private Git submodules

If your application uses private Git submodules, avoid storing credentials in `.gitmodules`. Use SSH URLs and provide an SSH key at deploy time.

1. Use an SSH URL for each submodule

```bash
# Add a new submodule (example)
git submodule add git@github.com:org/repo.git path/to/subdir
```

2. Provide an SSH key for the build

- Set the `CC_SSH_PRIVATE_KEY` environment variable with a private key that has read access to your submodule(s).

Check failure on line 60 in content/doc/develop/git.md

View workflow job for this annotation

GitHub Actions / vale

[vale] content/doc/develop/git.md#L60

[Google.OptionalPlurals] Don't use plurals in parentheses such as in 'submodule(s)'.
Raw output
{"message": "[Google.OptionalPlurals] Don't use plurals in parentheses such as in 'submodule(s)'.", "location": {"path": "content/doc/develop/git.md", "range": {"start": {"line": 60, "column": 103}}}, "severity": "ERROR"}
- Optionally set `CC_SSH_PRIVATE_KEY_FILE` to control the filename used on the instance.
- The key is installed into `~/.ssh` before the build so Git operations (including submodules) can authenticate.

Check notice on line 62 in content/doc/develop/git.md

View workflow job for this annotation

GitHub Actions / vale

[vale] content/doc/develop/git.md#L62

[Google.Passive] In general, use active voice instead of passive voice ('is installed').
Raw output
{"message": "[Google.Passive] In general, use active voice instead of passive voice ('is installed').", "location": {"path": "content/doc/develop/git.md", "range": {"start": {"line": 62, "column": 13}}}, "severity": "INFO"}
- Alternatively, commit `clevercloud/ssh.json` to reference a private key file in your repo (see the linked documentation for the expected format).

Check failure on line 63 in content/doc/develop/git.md

View workflow job for this annotation

GitHub Actions / vale

[vale] content/doc/develop/git.md#L63

[Vale.Spelling] Did you really mean 'repo'?
Raw output
{"message": "[Vale.Spelling] Did you really mean 'repo'?", "location": {"path": "content/doc/develop/git.md", "range": {"start": {"line": 63, "column": 90}}}, "severity": "ERROR"}

{{< callout type="info" >}}
Provide a key without pass phrase. Submodules are initialized during deployment unless you disable them with `CC_DISABLE_GIT_SUBMODULES`.

Check notice on line 66 in content/doc/develop/git.md

View workflow job for this annotation

GitHub Actions / vale

[vale] content/doc/develop/git.md#L66

[Google.Passive] In general, use active voice instead of passive voice ('are initialized').
Raw output
{"message": "[Google.Passive] In general, use active voice instead of passive voice ('are initialized').", "location": {"path": "content/doc/develop/git.md", "range": {"start": {"line": 66, "column": 47}}}, "severity": "INFO"}

Check warning on line 66 in content/doc/develop/git.md

View workflow job for this annotation

GitHub Actions / vale

[vale] content/doc/develop/git.md#L66

[Google.WordList] Use 'turn off' or 'off' instead of 'disable'.
Raw output
{"message": "[Google.WordList] Use 'turn off' or 'off' instead of 'disable'.", "location": {"path": "content/doc/develop/git.md", "range": {"start": {"line": 66, "column": 92}}}, "severity": "WARNING"}
{{< /callout >}}

[Learn more: Private SSH key configuration](/doc/reference/common-configuration/#private-ssh-key) · [Environment variable reference](/doc/reference/reference-environment-variables/)

Check warning on line 69 in content/doc/develop/git.md

View workflow job for this annotation

GitHub Actions / vale

[vale] content/doc/develop/git.md#L69

[Google.Colons] ': P' should be in lowercase.
Raw output
{"message": "[Google.Colons] ': P' should be in lowercase.", "location": {"path": "content/doc/develop/git.md", "range": {"start": {"line": 69, "column": 12}}}, "severity": "WARNING"}
Loading