Git Repository Overview
A Git Repository is a storage location where the versions of your files may be stored. This may be a hosted location or your own Git server.
Creating a Git Repository in Copado
To create a Git Repository in Copado;
- Click on the tab, Git Repositories.
- Click New
- Fill in all required fields
- Click Save
Copado will automatically perform a validation of your login credentials, and you will see the result of this validation when the page has loaded. Once the repository has been added you can create Git Backups.
From your Git provider copy the HTTPS URL. In Copado, create a new Git Repository record and paste the HTTPS URL into the URI field, complete the Username and Password fields and then save the record. If you are running a hosted Git repository, make sure Port 443 is open. More info here.
AWS CodeCommit: to connect CodeCommit repositories, copy the HTTPS clone url provided in the AWS Console, and then use the AWS Access Key as the Username and the AWS Secret Key as the Password.
From your Git provider, copy the SSH URL. In Copado, create a new Git Repository record and paste the SSH URL into the URI field, then save the record. Now you need to create a new pair of keys, to do so, press the button "Create SSH Keys", once you have created the keys, click on the "view" link next to the "id_rsa.pub" file and copy the content. On your Git provider site, add the public key (id_rsa.pub), see screenshot below.
If you are running a hosted Git repository, make sure Port 22 is open. IP restrictions are not supported for SSH, more info here.
Retrieving Commit information into Copado
Having commit information within Copado allow users to compare commits, deploy from git among other functionalities.
Retrieved Commits are displayed as a related list right after the detail information. If you are running CI processes this information will be updated automatically. To retrieve commits manually, press the button "Retrieve Commits", wait a few moments and reload the page.
Copado allows users to create a deployment directly from a Git Repository record. To create a deployment press the button "Create deployment" and select a starting and ending commit. Copado will create a deployment with 1 Git MetaData step including all committed files within those commits and will use the lat commit as the source. Optionally if there were deleted files, a Delete MetaData step will be created as well.
What to do when tracking other folders
When having other files within the git repository, that has nothing to do with the Salesforce metadata to be used for deployments, copado will ignore them so that your builds won't break. Copado will try to do the best to locate your salesforce root folder within your repository using different techniques. Nevertheless if Copado can't figure it out automatically, you can set the Copado root folder by simply creating an empty file named "copado_root" on the deployment root folder.
Link Copado to your repository's provider
As from Copado v7, you'll be able to see all relevant information about branches and commits in your Git repository provider's end. You will find this new "View in Git" field in the following objects:
- Git Snapshot (for the branch)
- Snapshot Commit (for the commits)
- User Story (for the feature branch if you are using Copado Git Flow)
- User Story Commit (for the commits)
How to use it:
1. Go to yor Git Repository record.
2. There are two new fields, Branch Base URL and Commit Base URL. You need to fill them up (you can go to your Git repository provider and open a branch and a commit to help you fill this fields):
3. If you navigate to one of your Git Snapshots, you will see the "View in Git" field with the name of the branch. If you click on it you'll be redirected to that branch in the Git repository (this applies to the User Story feature branch too):
4. If you navigate to one of the commits in your Snapshot, you will see the "View in Git" field with the id of the commit. If you click on it you'll be redirected to that commit in the Git repository (this applies to the User Story commits too)