Skip to main content

Using GitLab and Github on Nero

Code.stanford.edu is the suggested Stanford location for all things GitLab.

Discover Stanford-related projects, groups and snippets. Share your projects with others.

Using GitLab, code.stanford.edu

You will need an Gitlab personal access token in order to authenticate to code.stanford.edu.

  1. In a web browser, visit code.stanford.edu’s Personal Access Token page.
  2. Click the ‘Generate Token’ found on the right side of the “Personal access tokens” banner. Select the type of token and fill in the appropriate details.
    • Press the button ‘Generate token’
    • The field Your New Personal Access Token will appear at the top of the page. Copy this token to a secure location on your laptop - e.g. somewhere where you store your passwords. You will need this to log on. Do not put this in your git repo or put it in a public location!
    • At any point in the future if you want to get rid of this, you can just click ‘revoke’ next to the name of the token.
  3. Now, try testing your token on Nero.
    • Access a terminal on your instance either via SSH or a Jupyter Terminal
    • Create a repo or fork on code.stanford.edu
    • Type in: git clone https://code.stanford.edu/<sunet>/repoName. If you have a git repository on code.stanford.edu, this makes a copy of your forked git repository on Nero.
    • Fill in your Stanford username and the access token you created (do not use your Stanford password).
    • This should create a new directory on Nero with a copy of your repo.

Other GitLab Tips

The first time you push (git push origin <branch_name>) to code.stanford.edu, you need to set your global git config.

  Perform the following commands from Terminal:
     + `git config --global user.name <your_name>`
     + `git config --global user.email <your_email>`
  - You will need to use the access token again every time you push.

Using GitHub

To clone a GitHub repo onto Nero, access a terminal on your instance either via SSH or a Jupyter Terminal, then using the HTTPS method, clone your repo.

Example:

git clone https://github.com/username/your-repo.git

If you need to clone a private repo, you’ll need to use a personal access token to authenticate.

Github Personal Access Token documentation can be found here or move straight to creating a Github personal access token.

Feel free to contact us for more details or if you have questions.