If your teacher has turned on Git uploading, you can upload directly from your GitHub or GitLab repository to CodeGrade.
Some assignments may not have Git uploading turned on, ask your teacher about this if you cannot find this option in CodeGrade.
Some CodeGrade assignments allow you to connect your Git repository, so that every time you do a Git push, your work is uploaded to CodeGrade too. Setting up Git is very straightforward and has to be done only once.
Step 1: Click on the "Connect Git" button in CodeGrade.
Connect Git button.
You can only connect your Git repository to CodeGrade if this button is available to you. If it is not, your instructor did not turn Git on.
Step 2: Select your Git host.
Select the Git host in CodeGrade.
Select which Git host you use. Choose GitHub if you use that website and choose GitLab if you use GitLab or if your university has their own Git installation. After selecting the host, you will be taken to their website to log in and authorize CodeGrade.
Already made a Git connection before? You only have to authorize CodeGrade once! So if you already made a Git connection before, you can directly select or create a repository for your CodeGrade assignment.
Step 3: Log in and authorize CodeGrade.
Log in to your Git account and authorize CodeGrade.
You will only have to log in and authorize CodeGrade once, after that it will be available for all your other assignments inside CodeGrade too.
Step 4: Select your repo or create a new one.
Connecting a repository to CodeGrade.
After logging in and authorizing, you will find an overview of your repositories. You can connect an existing repository or create and connect a new one to this assignment.
Step 5: Connection made!
After selecting a repository, this repository will be cloned to CodeGrade and a first submission will be made. After this, you can start to use Git like you normally would and every git push command will result in a new submission in CodeGrade automatically!
Want to sign out of Git? You can undo your Git connection with CodeGrade by revoking access to the External Tool "CodeGrade" in your GitHub or GitLab account (this is managed via their website).
Manually setting up a Git connection
The steps below teach you how you can set up a Git connection manually:
Click on the Set up Git button, click on "Or manually connect your Git repository.", now select your Git host.
Next, copy the deploy key from the page to paste it in your repository. Go to the settings of your GitHub/GitLab repository, locate the Deploy Keys option and paste the key into the corresponding input field and click on the Add key button below it. You can leave the Write access allowed checkbox unchecked.
Go to the Add the webhook step in CodeGrade, and copy the URL. Next, go the webhook settings of your GitHub/GitLab repository, paste the URL into the corresponding input field. Follow the same for Secret Token as well.
Make sure the Push events trigger is turned on and Enable SSL verification is checked in your webhook settings. Click on Add webhook to connect your repository to CodeGrade. Now, every time you execute Git push, your work is automatically submitted to CodeGrade.
Your GitHub or GitLab repository is now connected to CodeGrade. Perform a git push to test out if everything is set up correctly.
If setting up Git manually, it is a good practice to check whether your webhook connection is set up correctly, simply do a git push if you have work to push or do an empty commit with the following command: git commit --allow-empty -m "Create a CodeGrade submission" && git push .
Learn how to turn on Git uploading for your assignment in CodeGrade: