Git
Repositories
Create repositories, then clone and push over HTTPS with a key as the password.
Create a repository
In Cloud (Repositories → New repository) or the Git portal (your organization → New repository). You need git:write. Names are 3–40 lowercase letters, numbers and dashes, unique in the organization.
Repositories are stored in AWS CodeCommit in ap-southeast-2, one per repository and named after your organization, so other organizations can't see or reach them.
Clone URL
https://git.cactive.com.au/<org>/<repo>.git<org> is your organization's slug. The Git portal's Code button shows the URL with a copy button, and so does the repository list in Cloud.
Authenticate
Git uses HTTP Basic authentication. The username can be anything; the password is a key of your organization:
| To | The key needs |
|---|---|
| Clone, fetch, pull | git:read |
| Push | git:write |
Any key type works; an API key with just the git scopes is the usual choice. Expired and revoked keys are rejected. Git asks for credentials only after the server challenges it, and a credential helper saves you entering the key each time.
git clone https://git.cactive.com.au/<org>/<repo>.git
# Username: anything
# Password: the keyA key from another organization is rejected and Git asks for credentials again. A repository that doesn't exist answers 404.
Branch protection
Settings → Branches sets rules for a branch, or for every branch with a prefix ending in * (release/*). A branch's own name wins over prefixes, then the longest prefix. A rule can:
- require a pull request, with 0–10 approvals (the author's own never counts) and, if you choose, reviews from the changed files' code owners;
- block force pushes, so the branch only moves forward;
- block deletion;
- list up to 20 people who may bypass the pull request: push directly and merge without the reviews. A bypass never lifts the force-push or deletion blocks or secret scanning, and every bypass is in the audit log.
Rules hold on every way into the repository: git push, commits in the browser, merges and promotes. Web commits to a branch that needs pull requests go to a new branch, and git push to it is refused:
remote: main is protected: changes need a pull request with 1 approval.
remote: Push to another branch and open a pull request.
! [remote rejected] main -> main (protected branch)A push that also updates other branches is refused as a whole. Changing a rule applies to open pull requests too. A restricted repository's default branch blocks force pushes and deletion even without a rule.
Code owners
A CODEOWNERS file, in GitHub's syntax, says who owns which paths: the first of .cactive/CODEOWNERS, CODEOWNERS and docs/CODEOWNERS on the target branch, where the last matching line wins. Owners are a member's @handle, a team (@team or @org/team) or an email address. With code owner reviews on, each changed path needs an approval from one of its owners; the pull request shows who owns what and who has approved, and Settings → Branches shows the file it found and any errors in it.
Secret scanning
Secret scanning refuses changes that carry credentials: AWS keys, Stripe keys, private keys, GitHub tokens and the platform's own keys. It checks git push, commits in the browser, and merges and promotes into a branch with a rule. It's on for restricted repositories and off for the rest until you turn it on. A finding shows the file, the line and the start of the value, never the value itself.
If a finding isn't a secret (a test fixture), someone who can write the repository can allow it for an hour, with a reason, from the link in the refused push. A real credential should be removed from the commits and revoked, not allowed.
Edit in the browser
The portal can create, edit, upload, move and delete files and commit them to the branch or to a new branch with a pull request. A web commit can change up to 1,000 files and 50 MB of content; changes over 100 files or 4 MB upload their files first and take a little longer. If the branch moved since you started, the commit is refused and you can commit to a new branch instead.
Download a ZIP
Code → Download ZIP downloads a branch or tag. Small repositories download at once; larger ones are packed in the background (the page waits and starts the download, usually within a minute) and kept for 7 days. Repositories over 512 MB at one commit can't be downloaded as a ZIP; clone them.
Pushing deploys
Pushing a branch starts a deployment for every Serverless App Service linked to the repository (see The build pipeline). Pushing tags and deleting branches don't deploy.
Limits
- One push request can carry up to about 6 MB. Larger pushes fail; push in smaller pieces, for example a few commits at a time.
- Requests time out after 5 minutes.
- Pushes larger than 6 MB. Coming soon
Delete a repository
In the Git portal, open the repository's Settings → Delete repository and type its full name to confirm (needs git:write). This deletes its branches and history and can't be undone. Its issues and pull requests are no longer shown.