github-education-resources / classroom

GitHub Classroom automates repository creation and access control, making it easy for teachers to distribute starter code and collect assignments on GitHub.
https://classroom.github.com
1.34k stars 566 forks source link

Error accepting course assignment #2509

Closed jeremymanning closed 4 years ago

jeremymanning commented 4 years ago

Describe the bug I encounter an error when I attempt to accept a course assignment.

To Reproduce Steps to reproduce the behavior:

  1. Go to assignment URL (https://classroom.github.com/a/rw4gMFGJ)
  2. Click "accept this assignment"
  3. Encounter error (screenshot below); message: GitHub repository could not be created from template, please try again. (You are forbidden from performing this action on github.com)

Expected behavior I expected the assignment repository to be created. Instead I received an error message.

Screenshots If applicable, add screenshots to help explain your problem.

Here's a screenshot displaying the error message:

Screenshot 2019-12-30 16 34 37

Additional context

I created the assignment using my primary username (jeremymanning), which is the sole owner of the classroom account under my organization (ContextLab, also sole owner). I initially tried accepting the assignment under the same username. I then tried logging out of all GitHub and GitHub classroom sessions and accepting the assignment under a separate test GitHub account that isn't associated with the course. I also tried deleting and re-creating the assignment (e.g., in case some error was introduced when I tried to accept the assignment as the course owner and/or assignment creator).

I'm not sure if it's relevant or related, but I'm also having trouble importing my course roster from Canvas. (I'll open a separate issue related specifically to that, but I'm noting it here as well in case the issues are linked.)

jeffrafter commented 4 years ago

Hi @jeremymanning sorry for the trouble; it looks like a change I shipped might be related. We just shipped a fix; can you try again?

jeremymanning commented 4 years ago

That fixed the problem-- it works great now (behavior is now as expected)! Thanks so much for addressing this so quickly!

JavierCane commented 4 years ago

Hi!

I'm having this very same problem. Could it be happening because a misconfiguration of the organization permissions or something else from my side? Or could it be something related to the mentioned bug?

Thanks!

jeffrafter commented 4 years ago

@JavierCane sorry you are having trouble. The bug associated with this issue is fixed so it is likely misconfiguration of organization permissions. If you are seeing a specific error that might help diagnose it.

JavierCane commented 4 years ago

How to reproduce:

The steps to reproduce the error and the error message are the very same as the ones described in this issue, that is:

  1. Create an assignment with a starter code repository specified (https://github.com/CodelyTV/php-basic-skeleton) and with the "Import starter code using a template repository" option enabled because it's a template repository.
  2. Go to assignment URL
  3. Click "accept this assignment"
  4. Encounter error message:

    GitHub repository could not be created from template, please try again. (You are forbidden from performing this action on github.com)

Potential hints:

It's interesting however that if I create an assignment without specifying a starter code, GitHub allows me to accept the assignment and it creates the repository under the GitHub Classroom Organization.

That's something that makes me think about actually having the Organization permissions properly configured, but having some kind of bug with the assignments and template repositories integration.

Thanks!

jamarFraction commented 4 years ago

Myself and others in my class are currently having the same issue. For some students it works, for the majority it doesn't.

acestronautical commented 4 years ago

I am also experiencing this issue with https://classroom.github.com/a/JCQTn8LW

chundhau commented 4 years ago

I think the issue has to do with how the instructor sets up the assignment. There is a beta feature that uses a "repository template" to clone the repo when the assignment is selected. It seems that this beta feature has, or used to have, a bug. When I switched, from the instructor interface, to the non template option of distributing the repo, the problem seemed to go away.

d12 commented 4 years ago

Hey all, we're digging into this right now. We'll update here soon when we have more info.

jeffrafter commented 4 years ago

Thanks for the patience everyone. We spent some time digging into this and the recent errors around accepting are not related the original issue (which was a particular bug that was fixed).

For the recent reports there appear to be a couple of factors at work.

For template repositories

It appears that https://github.com/CodelyTV/php-basic-skeleton is owned by an organization which has Third Party Access Restrictions enabled (the default). To see if this is the case you would can click on your org name and then click on settings. Then click on the Third-party access tab on the sidebar. You'll end up at a link like:

https://github.com/organizations//settings/oauth_application_policy

If you see this you are restricting access and students will get the dreaded Forbidden error. You have two options:

For the second solution go here:

https://github.com/settings/connections/applications/64a051cf1598b9f0658f/?return_to=classroom

Scroll down to the bottom and find your org:

You should see an x and a Grant button. Click the Grant button and everything should be solved. Note, when setting up a Classroom you normally go through this step and we're looking into how that might have been missed (it is possible it was revoked later).

For the importer

Using the legacy importer works around the Third-Party access but can fail for a separate reason. If your repository contains a GitHub Action Workflow it might be restricted from being cloned. In such a case you could remove the workflow from the source repository and it should work, or switch to template repositories (recommended). We're working on an internal fix to solve this problem regardless.

jeffrafter commented 4 years ago

As a followup: using the legacy importer with actions should now work as expected as well.

JavierCane commented 4 years ago

Thanks for the fix. It's working properly now 🤟🙌