Git Version Control

Note

Trial Projects are not allowed to directly access the internet. (We cannot allow such access for free users, since when we did, malicious users launched attacks on other computers from CoCalc.) Enable internet access by purchasing a license.

Clone a Repository Using New

The easiest way to clone a repository from GitHub is arguably via New panel:

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/id_rsa.pub (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.