Are there any recommended methods to integrate git with colab?
For example, is it possible to work off code from google source repositories or the likes?
Nei
You can use ssh protocol to connect your private repository with colab
Generate ssh key pairs on your local machine, don't forget to keep
the paraphrase empty, check this tutorial.
Upload it to colab, check the following screenshot
from google.colab import files
uploaded = files.upload()
Move the ssh kay pairs to /root and connect to git
! rm -rf /root/.ssh/*
! mkdir /root/.ssh
! tar -xvzf ssh.tar.gz
! cp ssh/* /root/.ssh && rm -rf ssh && rm -rf ssh.tar.gz
! chmod 700 /root/.ssh
! ssh-keyscan gitlab.com >> /root/.ssh/known_hosts
! chmod 644 /root/.ssh/known_hosts
! git config --global user.email "email"
! git config --global user.name "username"
! ssh git@gitlab.com
Authenticate your private repository, please check this Per-repository deploy keys.
Use ! git@gitlab.com:{account}/{projectName}.git
note: to use push, you have to give write access for
the public ssh key that you authenticate git server with.