Using GitLab 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.
Setting up code.stanford.edu (GitLab) access on Nero
Stanford GitLab uses two-factor authentication.
As a result, you need an access token on Nero to authenticate to code.stanford.edu.
- In a web browser, visit code.stanford.edu’s Personal Access Token page.
- Fill in ‘Add a personal access token’, select ‘api’ for the level of access.
- Press the button ‘Create personal access token’
- The field
Your New Personal Access Tokenwill 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.
- Now, try testing your token on Nero. Open up Jupyter on Nero by visiting nero.compute.stanford.edu.
- Click on
Terminalto start a Terminal session.
- Make sure you are in your home directory or a directory within home (not
- 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.
- Click on
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.
Reminder - do not commit data to code.stanford.edu. Data must stay on Nero.
Special thanks to Data Science for Social Good (DSSG) for assisting with these instructions!
Feel free to contact us for more details or if you have questions.
What about cloning GitHub Repositories?
Yes, you can clone GitHub repos onto Nero. Nero does not allow SSH use with GitHub. If it is a public repo, you must use HTTPS.
git clone https://github.com/your-repo/your-repo.git
If it is a private repo, you must set up a github personal access token - info here: https://help.github.com/en/github/authenticating-to-github/creating-a-personal-access-token-for-the-command-line (if you are accessing a repo that requires sign in)