Cloning a GitLab Repository into your BadgerCompute RStudio Session
git.doit.wisc.edu) into an RStudio Server session on BadgerCompute. The approach uses HTTPS with a Personal Access Token (PAT). SSH is not practical here because files outside ~/work are wiped on session reset, meaning SSH keys stored in ~/.ssh would be lost each time.
- An active BadgerCompute session at
launch.badgercompute.wisc.edu - A UW NetID with Reporter-level access or higher on the target GitLab project
- A Personal Access Token generated from your user profile at
https://git.doit.wisc.edu/-/user_settings/personal_access_tokensread_repositoryscope — required for cloningwrite_repositoryscope — required if you intend to push changes
- A Terminal open in RStudio Server: Tools → Terminal → New Terminal
2 Step 2: Verify git is Available
which git
git --versionYou should see a path like /usr/bin/git and a version string such as git version 2.x.x. Git is pre-installed in the BadgerCompute environment.
3 Step 3: Configure git Identity
~/.gitconfig lives outside ~/work and is deleted on session reset. You will need to re-run these lines at the start of each new BadgerCompute session. See the Session Reset section for a setup script that automates this.
Set the name and email that will be attached to your commits:
git config --global user.name "Your Name"
git config --global user.email "netid@wisc.edu"4 Step 4: Set Up Persistent Credential Storage
By default, git stores credentials in ~/.git-credentials, which is outside ~/work and wiped on reset. Anchor it to ~/work with a symlink so your token survives session resets:
touch ~/work/.git-credentials
ln -s ~/work/.git-credentials ~/.git-credentials
git config --global credential.helper storeVerify the symlink is in place:
ls -la ~/.git-credentials
# Expected output:
# lrwxrwxrwx ... /home/jovyan/.git-credentials -> work/.git-credentialsIf you have run this before, ln will report that the symlink already exists — that is expected and means your credentials are already persisted. No action needed.
5 Step 5: Clone the Repository
git clone https://git.doit.wisc.edu/<group>/<project>.gitWhen prompted:
- Username: your NetID (e.g.
lares) - Password: your Personal Access Token
Never paste your Personal Access Token into a shared script or commit it to a repository. It grants access to your GitLab account and should be kept private.
After a successful clone, credentials are written to ~/work/.git-credentials automatically. Subsequent git pull and git push commands will not prompt again.
A 403 “not allowed to download code” error means one of:
Wrong token type — you may have generated a Project Access Token (a bot account) instead of a Personal Access Token. Verify by running:
curl -H "PRIVATE-TOKEN: <your-token>" https://git.doit.wisc.edu/api/v4/userThe response should show your own NetID and
"bot": false. If you see"bot": true, generate a new token from your user profile instead of the project settings.Insufficient access level — Guest access (level 10) cannot clone. You need Reporter (level 20) or higher. Ask the project owner to update your role at:
https://git.doit.wisc.edu/<group>/<project>/-/project_members
6 Step 6: Verify the Clone and Remote
cd <project-name>
git remote -vExpected output:
origin https://git.doit.wisc.edu/<group>/<project>.git (fetch)
origin https://git.doit.wisc.edu/<group>/<project>.git (push)
7 Step 7: Open the Project in RStudio
With the repository cloned, open it as an RStudio Project:
File → Open Project → navigate to ~/work/<project-name>
If the repo contains an .Rproj file, open that directly. Otherwise create a new project in the cloned directory:
File → New Project → Existing Directory → select ~/work/<project-name>
The Git pane will appear in the upper-right panel (alongside Environment and History), giving you point-and-click access to pull, commit, push, and diff without leaving RStudio.
If the Git pane does not appear after opening the project, try restarting RStudio within the session: Session → Restart R.
8 Handling Session Resets
BadgerCompute sessions shut down after 4 hours or 10 minutes of inactivity. On reset, ~/.gitconfig is deleted but ~/work/.git-credentials survives.
Save the following script once to ~/work/setup-git.sh to restore your config quickly at the start of each session:
#!/bin/bash
# ~/work/setup-git.sh
# Run at the start of each BadgerCompute session.
git config --global user.name "Your Name"
git config --global user.email "netid@wisc.edu"
git config --global credential.helper store
# Restore symlink if missing
if [ ! -L ~/.git-credentials ]; then
touch ~/work/.git-credentials
ln -s ~/work/.git-credentials ~/.git-credentials
echo "Credentials symlink restored."
else
echo "Credentials symlink already in place."
fi
echo "git config restored."Make it executable once:
chmod +x ~/work/setup-git.shRun it at the start of each new session:
bash ~/work/setup-git.shOr from the RStudio R console:
system("bash ~/work/setup-git.sh")9 Quick Reference
| Task | Command |
|---|---|
| Verify git | git --version |
| Set identity | git config --global user.name "Name" |
| Set email | git config --global user.email "netid@wisc.edu" |
| Enable credential store | git config --global credential.helper store |
| Check symlink | ls -la ~/.git-credentials |
| Clone repo | git clone https://git.doit.wisc.edu/<group>/<project>.git |
| Verify remote | git remote -v |
| Restore session config | bash ~/work/setup-git.sh |
10 See Also
- BadgerCompute Documentation — general platform documentation
- BadgerCompute Policies — usage policies and session limits
- UW-Madison GitLab —
git.doit.wisc.eduhome - BadgerCompute Community Forum — peer support and announcements