Clone over SSH
Add your public key to your account and clone, fetch and push over SSH.
An account SSH key identifies you: it reaches the repositories of the organization you added it in, as far as your IAM policies allow. Passwords are not accepted over SSH. Replace laptop with a label for the machine the key is on.
Prerequisites
- An SSH key pair, for example
~/.ssh/id_ed25519.pub. - Permission for
git:RegisterSshKey. Without it the Add a key section is not shown. git:PullRepositoryon the repository to clone and fetch, andgit:PushRepositoryto push.
Add your key
- Open Account → SSH keys.
- Under Add a key, for Label, enter laptop.
- For Public key, paste the contents of your
.pubfile. - Choose Add key. The key appears under Your keys with its fingerprint.
dcloud git ssh-keys create --name laptop --public-key "$(cat ~/.ssh/id_ed25519.pub)"POST /git/api/ssh-keys
{ "name": "laptop", "publicKey": "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIEXAMPLE jane.doe@example.com" }resource "dcloud_git_ssh_key" "laptop" {
name = "laptop"
public_key = file("~/.ssh/id_ed25519.pub")
}A key that is already registered, as anyone's account key, is refused with 409
That key is already registered. A key that cannot be parsed is refused with 400.
Clone
Copy the URL from the repository's Clone button, on its SSH tab, or build it:
git clone ssh://git@git.<platform domain>/my-org/my-repo.gitmy-org is your organization's slug. The port appears in the URL only when it is not 22.
Important
Check the server's host key fingerprint before you accept it on the first connection. It is shown on Account → SSH keys, under Setting up, as Server fingerprint.
Result
The repository is cloned; push and fetch use the same key. When the server refuses, git prints one of these:
| Message | Cause |
|---|---|
Repository not found |
The repository does not exist, or your policies do not allow git:PullRepository |
Permission denied: you can read this repository but not push to it (git:PushRepository). |
A push without git:PushRepository |
This SSH key is registered to a different organization. … |
The key was added in another organization; add it in this one |
Related
- Clone over HTTPS
- Add a deploy key for a machine rather than a person.
POST /git/api/ssh-keys·dcloud git ssh-keys create·dcloud_git_ssh_key