This page will walk you through the process of authenticating with SSH or HTTPS and configuring Git for use with Mage Git Sync.
git config --global --add safe.directory <local repo path>
)SSH
eval $(ssh-agent -s) && ssh-add ~/.ssh/id_rsa
Check .gitignore settings
.preferences.yaml
is added to your repo’s .gitignore
file so that your Git settings aren’t pushed to Github.Navigate to Git settings
Select SSH as the authentication type.
Set up your SSH key
Add Git details
Remote repo url
: Your Github repository’s remote url. Use the SSH link instead of HTTPS link.Local directory path
: The directory in your machine that will be synced with the Github repository. If this field is omitted, it will default to the path determined by Python’s os.getcwd()
. You can check what your current working directory is in a Scratchpad block.[Optional] Enable One-way Git Sync
Branch Name
: The name of the branch you want to sync with.Include submodules
: If your repo has submodules, tic this box to include them in the sync.Sync before each trigger run
: If you'd like a sync to occur before a trigger run to ensure that the latest code is used, tic this box.Sync on server start up
: If you'd like to sync on server start up, tic this box.Fill out the remaining fields.
Username
: Your git username. If you push to your remote repo, this username will show up next to your commits.Email
: Your git email. Used for the same purpose as your username.SSH public key in base64
, SSH public key in base64
: Enter your SSH public and private key encoded in base64. You can follow the instructions in the field description if you want to Mage to save your SSH keys.Save your Git settings
HTTPS/Token
Check .gitignore settings
.preferences.yaml
is added to your repo’s .gitignore
file so that your Git settings aren’t pushed to Github.Navigate to Git settings
Add Git details
Remote repo url
: Your Github repository’s remote url. Use the SSH link instead of HTTPS link.Local directory path
: The directory in your machine that will be synced with the Github repository. If this field is omitted, it will default to the path determined by Python’s os.getcwd()
. You can check what your current working directory is in a Scratchpad block.[Optional] Enable One-way Git Sync
Branch Name
: The name of the branch you want to sync with.Include submodules
: If your repo has submodules, tic this box to include them in the sync.Sync before each trigger run
: If you'd like a sync to occur before a trigger run to ensure that the latest code is used, tic this box.Sync on server start up
: If you'd like to sync on server start up, tic this box.Fill out the remaining fields.
Username
: Your git username. If you push to your remote repo, this username will show up next to your commits.Email
: Your git email. Used for the same purpose as your username.Access token
: Enter the Git access token that you created in step 4.Save your Git settings
SSH
Check for existing SSH key
Generate a new SSH key
Add SSH key to your Git provider
Test your SSH connection
Add SSH to known hosts
yes
and press enter to continue.