Git Version Control


First, despite the fact that you are accessing CoCalc through the internet, you are actually working in a highly restricted environment. Processes running inside a free project are not allowed to directly access the internet. (We do not allow such access for free users, since when we did, malicious users launched attacks on other computers from CoCalc.) Enable internet access by adding the “internet access” quota. See Project Upgrades.

Git command-line

CoCalc gives you full control over Git via a Linux Terminal in the command-line.

Once you have enabled internet access for your project, you can to connect to online Git services like GitHub, GitLab or Bitbucket. You can immediately pull from a public repository.

To access private repositories or to push your new commits, you need to create an SSH key and explicitly allow that account/key access to access the remote repository.

  1. Create an SSH key public/private key pair by typing the command ssh-keygen. (consult Setup SSH Keys for more information)

  2. Copy the content of .ssh/ (could be named similarly, but has the ending .pub) to GitHub’s setting for setting up an additional key. To open that file quickly, you can run this in the Terminal: open ~/.ssh/id_*.pub.

  3. If necessary, navigate to a different directory.

  4. Use Git as usual.

Git graphical desktop emulator

You can use Git apps in an X11 Desktop. Open an .x11 file in CoCalc. There are launch buttons in the panel at lower left for gitg and gitk.

Host a Git repository in CoCalc

You can create a Git repository hosted inside a CoCalc project, and then access that repository remotely from any client computer that has SSH Access to the project enabled. See “Hosting a git repository on CoCalc” in the blog article, Using SSH with CoCalc.