Getting started with Git
Create a repository, push to it over HTTPS, open a pull request and merge it, in about ten minutes.
Last updated 18 November 2026View as Markdown
Replace these values:
- my-repo: the repository name.
- my-org: your organization's name as it appears in clone URLs.
5d6c2a1e-7b3f-4c8d-9e0a-1b2c3d4e5f60: the repository id, which the create call returns anddcloud git repositories listshows.
Prerequisites
giton your machine.- Permission for
git:CreateRepository,git:CreateAccessToken,git:PushRepository,git:CreatePullRequest,git:MergePullRequest,git:DeleteRepositoryandgit:DeleteAccessToken. TheAdministratorAccesspolicy grants all of them. - In the Deutsche Cloud Console, also
git:ListRepositoriesto open Git → Repositories (without it the page shows only an access-denied notice). - In the Deutsche Cloud Console, also
git:GetRepositoryto open the repository's pages (without it the page is not found). - In the Deutsche Cloud Console, also
git:GetPullRequestto open the pull request (without it the page is not found). - In the Deutsche Cloud Console, also
git:ListAccessTokensto open Account → Git tokens (without it the page shows an access-denied notice). - For the CLI tab, the
dcloudCLI, signed in.
Step 1: Create a repository
- Open Git → Repositories, then choose New repository.
- On step Identity, under Source, choose Start empty.
- For Repository name, enter my-repo.
- Under Visibility, keep Private, then choose Continue.
- On step Initialisation, keep the default branch
mainand leave the starter files off, then choose Continue. - On step Access, choose Create repository. The repository's page opens.
dcloud git repositories create --name my-repo --visibility privatePOST /git/api/repositories
{ "name": "my-repo", "visibility": "private" }Step 2: Create an access token
- In the repository, choose Settings, then Access tokens.
- Choose Create token.
- For Name, enter laptop. For Expires, choose In 7 days.
- Keep Repositories at Only my-repo and Permissions at Read and write (clone, fetch and push).
- Choose Create token. Copy the token now: it is shown once.
From the CLI and API a token without --repository-ids reaches every repository you can reach,
and one without --expires-in-days never expires.
dcloud git access-tokens create --name laptop --expires-in-days 7POST /git/api/access-tokens
{ "name": "laptop", "expiresInDays": 7 }The token has the form prefix.secret.
Step 3: Clone and push
git clone https://git.<platform domain>/my-org/my-repo.git
cd my-repo
echo "# my-repo" > README.md
git add README.md && git commit -m "Add README"
git push origin HEAD:main
git switch -c add-greeting
echo "Hello" > hello.txt
git add hello.txt && git commit -m "Add greeting"
git push origin add-greetingWhen git asks, give the token's prefix as the username and its secret as the password. Pasting
the whole prefix.secret value into either field also works.
Step 4: Open a pull request
- In the repository, choose Pull requests, then New pull request.
- Pick
add-greetingas the source branch andmainas the target branch. - For the title, enter Add greeting.
- Choose Create pull request. The pull request opens with its merge status.
dcloud git pulls create 5d6c2a1e-7b3f-4c8d-9e0a-1b2c3d4e5f60 \
--title "Add greeting" --source-branch add-greeting --target-branch mainPOST /git/api/repositories/5d6c2a1e-7b3f-4c8d-9e0a-1b2c3d4e5f60/pulls
{ "title": "Add greeting", "sourceBranch": "add-greeting", "targetBranch": "main" }Step 5: Merge it
- On the pull request, choose the method Squash.
- Choose Merge pull request. The pull request shows Merged.
dcloud git pulls merge 5d6c2a1e-7b3f-4c8d-9e0a-1b2c3d4e5f60 1 --method squashPOST /git/api/repositories/5d6c2a1e-7b3f-4c8d-9e0a-1b2c3d4e5f60/pulls/1/merge
{ "method": "squash" }main now holds the greeting. Run git pull origin main to see it locally.
Clean up
Warning
Deleting a repository deletes all of its code, commits, branches, tags and history. It cannot be undone.
- In the repository, choose Settings, then Danger zone.
- Under Delete this repository, choose Delete repository, type the repository's name to confirm, and choose Delete repository.
- Open Account → Git tokens, choose Revoke on the token you created, and confirm with Revoke. (On another repository's Settings → Access tokens, the token's actions menu has Revoke token.)
dcloud git repositories delete 5d6c2a1e-7b3f-4c8d-9e0a-1b2c3d4e5f60
dcloud git access-tokens list
dcloud git access-tokens delete token-idDELETE /git/api/repositories/5d6c2a1e-7b3f-4c8d-9e0a-1b2c3d4e5f60Then DELETE /git/api/access-tokens/{id} with the token's id.
Next steps
- Clone over SSH with a key instead of a token.
- Protect a branch so changes land only through reviewed pull requests.
- Import a repository you already have elsewhere.
Did this page help you?