首页 > 解决方案 > What is a 'temporary clone token' (in GitHub)

问题描述

I'm using GitHub Classroom to manage student assignments through GitHub. The basic workflow is that I create an assignment (including a starter repo), the students fork the repo on GitHub, clone it to their computers, then commit/push their changes back to GitHub.

I'd like to modify their repos and push my changes (technically I just want to add a file with feedback, not change their code, but that's neither here nor there).

When I try to push the changes back to GitHub I get the following error:

remote: Temporary clone tokens are read-only.
fatal: unable to access 'https://github.com/2019-BIT-142/bit-142-lesson-10-StudentsName.git/': The requested URL returned error: 403

What is a 'temporary clone token'? Why am I getting a 403 (forbidden) response?

I even wiped out my GitHub credentials (I'm using the Windows Credential Manager) and it's not even asking me for my username / password, so I'm assuming it's a problem with the 'clone token' itself, not my account.

标签: gitgithub

解决方案


That feature comes from the project education/classroom.

education/classroom issue 2182 includes:

Unfortunately, this is a known limitation of Classroom Assistant since we use a temporary token to clone the repository from GitHub (we decided to do this so that Classroom Assistant wouldn't have to be its own OAuth app).

The workaround right now is to either clone the assignment again (since the tokens would be refreshed) or manually replace the URL in the repositories to remove the temporary token.
This process and the feature request, in general, are outlined in education/classroom-assistant#103.

That PR states:

The token for a repository downloaded with Classroom Assistant expires rather fast, which means I can download all repos for an assignment, but if a student makes any changes (for example if I tell them to make changes), I have to download their repo again, because the token has expired. I cannot pull their changes.

There are scripts dedicated to leave feedbacks: NNHSComputerScience/gitHubScripts

That said, I'm not sure if this is still my preferred approach to providing feedback to students. We are currently exploring using GitHub Issues instead.

I agree that committing to the repo is not the most ideal way to give feedback. I've had this idea for a long time that the feedback should come in the form of a code review on GitHub.


推荐阅读