Setting Up a Git Connection
Setting Up a Git Connection
Two steps: your own access token on your profile, then the repository it unlocks.
Where the setup lives
Your access token is part of your profile, not a company setting — a commit carries authorship, so the token belongs to the person making it. There are two ways in, and both open the same page:
- Settings → Git Access Tokens. Click Settings at the top right of any screen to open your profile, then the Git Access Tokens card. This is the main route.
- Script Engine → Git. A shortcut in the Script Engine menu, for when you are already working there.
The page has two halves: Git access tokens, which are yours alone, and Repositories, which your company shares and which only a Builder can change.
Step 1 — Add your access token
Create the token at your git host first, with permission to read and write the repository, then add it here.
- Click Add a token.
- Name — how you will recognise it, for example
Bitbucket (work). A repository connection points at this name, so it cannot be renamed later. - Username — see the table below; what belongs here depends on your host.
- Access token — paste the token from your git host.
- Save.
The token is never shown again. DataMagik stores it encrypted and does not read it back to the screen, so editing a token shows its username but an empty token box — leave that box empty to keep the stored token, or paste a new one to replace it. Rotating a token is exactly this: edit, paste the new one, save.
What goes in the username field
| Host | Username | Token |
|---|---|---|
| Bitbucket | Your Atlassian account email | An API token / app password |
| GitHub | Your GitHub username (ignored for a personal access token, but harmless) | A personal access token with repository access |
| Azure DevOps | Leave empty | A personal access token with Code (read & write) scope |
| Other / self-hosted | Whatever your host expects | Whatever your host expects |
The Bitbucket row is the one that catches people. Bitbucket's git endpoint does not want your email, but its API — which is how pull requests are opened — does. DataMagik supplies the right identity to the git endpoint itself, so storing your email here fixes pull requests without breaking cloning. If pull requests fail with an authentication error while everything else works, this field is the first thing to check.
Step 2 — Add the repository
In Repositories, on the same page, click to add a connection. You need Builder permission for this.
- Name — how the repository appears in the editors, for example
Plex SQL (Azure DevOps). - Repository URL — the HTTPS clone URL, for example
https://bitbucket.org/yourteam/plex-sql.gitorhttps://dev.azure.com/org/Project/_git/Repo. SSH URLs are not used. - Default branch — nothing is pre-filled on purpose. Often
masterrather thanmain— check the repository, because a guessed branch produces a connection that tests green against nothing. - Provider — Azure DevOps, GitHub, Bitbucket, or Other / self-hosted. This only decides how pull requests are opened; pushing works the same everywhere.
- Access token credential — pick the token you added in step 1.
- SQL path and Script path — the default file name suggested when you match something new. They default to
sql/{name}.sqlandscripts/{name}.js, where{name}is the item's name. You can always choose a different folder and file name at match time; these are only the starting suggestion.
Step 3 — Test it
Use Test connection. A working connection reports the branches it found and confirms your default branch exists. Common answers:
- "The git host rejected the credential" — the token is wrong, expired, or lacks access to this repository. Check the username column above too.
- The default branch is not found — the repository uses a different name. Change it rather than creating the branch.
- "Not working" shown against a connection later — a host refused the token during normal use, so the connection is flagged without anyone having to press Test. A successful Test clears it.
Step 4 — Reload the editor
No Git button in the editor? That is expected until a repository exists. The SQL Editor and Script Engine only show the Git button once your company has at least one repository connection — a button whose only answer would be "add a connection first" is noise on a toolbar that is already full. The check runs when the editor page loads, so after adding the first connection, reload the editor and the button appears. It is in the toolbar at the top right, with a branch icon, near Save.
Adding a token alone is not enough — the button keys off the repository, not the token. If you have a connection and still see no button, check that it is marked active and that you can see it in the Repositories list.
Deleting a token here does not revoke it. Removing it from DataMagik stops DataMagik using it; it stays valid at your git host until you revoke it there. Revoke it at the host if that is what you intend.