Connect a Git repository
Create an access token, add a Git integration, connect a repository to a pipeline project and sync on every push.
A pipeline project reads its pipeline code from a Git repository you already have. Vegalake does not create repositories. You connect an existing one through a Git integration: an access token for your Git provider, stored in a workspace Secret and shared by any pipeline project in the workspace.
Supported providers are GitHub, GitLab, Bitbucket Cloud and Azure DevOps. GitHub Enterprise Server and GitLab Self-Managed are supported through a custom provider URL.
Before you start
You need permission to create Git integrations in the workspace, use permission on the vault that will hold the token, and a repository whose default branch has at least one commit. Vegalake cannot sync an empty repository.
Step 1: Create an access token
Vegalake signs in to your provider with a token you create. Give the token access only to the repositories your pipeline projects use.
| Provider | Token to create | Permissions |
|---|---|---|
| GitHub | Fine-grained personal access token, with Repository access set to the selected repositories. A classic token with the repo scope also works. | Contents: Read and write. Metadata: Read is added automatically. |
| GitLab | Personal, group or project access token, with the Reporter role or higher | read_api and read_repository |
| Bitbucket Cloud | Repository or workspace access token | Repositories: Read |
| Azure DevOps | Personal access token, scoped to the organization | Code: Read |
On GitHub, you can also browse the repository, create branches and commit changes from Vegalake, and those actions need write access. If you only want Vegalake to read and sync your code, give the GitHub token Contents: Read-only. On the other providers, Vegalake only reads and syncs, so read access is enough.
Bitbucket app passwords and GitHub App installations are not supported as Git integration credentials. Use one of the tokens above.
Token expiry
Sync stops when the token expires. Set an expiry date that suits your security policy, and put a reminder in your calendar to replace the token before it expires. To rotate a token, update the Secret's value; the integration keeps working without changes.
Step 2: Store the token as a Secret
Add the token as a Secret in one of the workspace's vaults. You can also create the Secret directly in the integration form in the next step. Read Secret vaults for how vault permissions work.
Step 3: Add the Git integration
Open Git integrations
In VegaFlow, open Pipelines, then Git integrations, and select Connect provider.
Describe the provider
Enter a name, choose the provider, and enter the Account: the GitHub user or organization, GitLab user or group, Bitbucket workspace or Azure DevOps organization that owns the repositories. The account identifies the integration in lists. Vegalake signs in with the token, not the account name.
Set a custom provider URL (self-hosted only)
For GitHub Enterprise Server or GitLab Self-Managed, enter your server's HTTPS address, for example https://git.example.com. Leave it empty for github.com, gitlab.com, bitbucket.org and dev.azure.com. A self-hosted server must be enabled for your organization first. Contact Vegalake support to enable it.
Choose the credential Secret
Select the Secret that holds the token from Step 1.
Add a webhook Secret (optional)
To sync as soon as a branch is pushed, select or create a second Secret with a random value of at least 32 characters, for example the output of openssl rand -hex 32. You will enter the same value in your provider in Step 5. Without a webhook, Vegalake checks tracked branches for new commits every few minutes.
To create an integration through the API, use the Git integrations endpoints:
{
"name": "Acme GitHub",
"provider": "GITHUB",
"provider_account_id": "acme",
"credential_secret_namespace_id": "<vault id>",
"credential_secret_id": "<token secret id>",
"webhook_secret_namespace_id": "<vault id>",
"webhook_secret_id": "<webhook secret id>"
}provider is one of GITHUB, GITLAB, BITBUCKET or AZURE_DEVOPS. Set base_url only for a self-hosted server.
Step 4: Connect the repository to a pipeline project
Open the pipeline project, go to Project & repository and fill in the Repository section:
| Field | GitHub | GitLab | Bitbucket Cloud | Azure DevOps |
|---|---|---|---|---|
| Repository | owner/repository | group/project | workspace/repository | organization/project |
| Provider repository ID | Optional | Optional; the numeric project ID also works | Optional | Required: the repository's ID (a GUID) |
Set Default branch to the branch your pipelines are released from, such as main.
To find an Azure DevOps repository ID, open https://dev.azure.com/{organization}/{project}/_apis/git/repositories/{repository}?api-version=7.1 while signed in and copy the id field.
Then add at least one definitions root: the repository folder Vegalake scans for pipeline declarations, such as pipelines. Read Pipeline projects for environments, tracked branches and builds.
Step 5: Add the push webhook (optional)
Skip this step if you did not add a webhook Secret in Step 3. Open the Git integration in Vegalake and copy its Webhook URL. Then add a webhook in your provider:
| Provider | Where | Settings |
|---|---|---|
| GitHub | Repository or organization Settings → Webhooks → Add webhook | Payload URL: the webhook URL. Content type: application/json. Secret: the webhook Secret's value. Events: Just the push event. |
| GitLab | Project or group Settings → Webhooks → Add new webhook | URL: the webhook URL. Secret token: the webhook Secret's value. Trigger: Push events, all branches. |
| Bitbucket Cloud | Repository settings → Webhooks → Add webhook | URL: the webhook URL. Secret: the webhook Secret's value. Triggers: Repository push. |
| Azure DevOps | Project settings → Service hooks → Create subscription → Web Hooks | Trigger: Code pushed, for the connected repository. URL: the webhook URL. Basic authentication: any username, and the webhook Secret's value as the password. |
One webhook URL serves every repository connected through the same integration, so you can add it at the organization or group level instead of on each repository.
A push queues a sync for each project and environment that tracks the pushed branch. A push only becomes a release or deployment if the project's policy allows it. Read Git and deployments for what happens after a push.
Troubleshooting
| Symptom | What to check |
|---|---|
Credential access requires use permission on the vault | The person or service principal working with the project needs use permission on the vault that holds the token. |
| Authentication fails | The token has expired, been revoked, or cannot see the repository. Check its permissions against Step 1 and update the Secret. |
| The repository or branch is not found | Check the Repository format for your provider, and that the default branch exists and has at least one commit. |
| Custom Git provider host is not allowed | Your self-hosted server has not been enabled. Contact Vegalake support. |
| Browsing or editing is not available for this Git provider | Repository browsing, branch creation and commits from Vegalake are available for GitHub only. Sync works for every provider. |
| Webhook deliveries are rejected | The integration has no webhook Secret, the value in the provider does not match, or the value is shorter than 32 characters. On GitHub, the content type must be application/json. |
| Pushes do not start a sync | The integration is disabled, the pushed branch is not tracked by any environment, or the project has no definitions root. On Azure DevOps, check that Provider repository ID is the repository's GUID. |