Example of how to reference private repositories using SSH for authentication. SSH option is more secure and should be the preferred approach over using HTTPS with token.
Set up an SSH key and add the public key to your Bitbucket Account settings (steps here)
When generating the new SSH key, you should not add a password (leave blank).
Set up an SSH key and add the public key to your Github Account (steps here)
When generating the new SSH key, you should not add a password (leave blank).
"dependencies": {
"my-private-github-dependency": "git+ssh://[email protected]/org-name/my-private-github-dependency.git#branch",
"my-private-bitbucket-dependency": "git+ssh://[email protected]/workspace-name/my-private-bitbucket-dependency.git#branch",
"my-private-bitbucket-dependency-2": "git+ssh://[email protected]/workspace-name/my-private-bitbucket-dependency.git#v0.1.0"
}
Note that you can use a specific branch or tag on the dependency url after the
#
.
-
Generate a new SSH Key pair in your main repository.
- In the repository Settings, go to SSH keys under 'Pipelines'.
- Click "Generate keys" to create a new SSH key pair.
- Clink "Copy public key" to copy it into your clipboard.
-
Add the public key to the dependency repository.
- In the repository Settings, go to Access keys under 'General'.
- Click "Add key" to add the public key you copied in the first step.
- Add a label and the public key and click "Add SSH Key".