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.35k stars 569 forks source link

Cannot set a private fork GitHub repo as the starter code repo #1431

Open eblanton opened 6 years ago

eblanton commented 6 years ago

Issue

What you were trying to do ?

I am trying to create an assignment based on a repository from the organization with which GitHub Classroom is associated. It is the first assignment in this particular Classroom. I have used GHC in the past.

What happened (include screenshot if you can) ?

When I type in the organization name into the starter code box (so that I can select the base repository), or any substantial portion thereof, it says "We couldn't find any matching repositories". When I type the repository name by itself (without the organization), it lists a bunch of unrelated repositories (which is fair, the repo name is not likely to be very unique).

Step-by-step reproduction instructions

  1. Create organization for a semester of a given class. I am the owner of the organization.
  2. Create a GitHub Classroom for the organization.
  3. Skip roster.
  4. Fork a repository from another, base organization into the semester organization -- repo is private, forking is permitted.
  5. Click "Create your first assignment".
  6. Click "Create an individual assignment".
  7. Click in "Add your starter code from GitHub (optional)" box.
  8. Type first few letters of organization name, full organization name, or full organization name/repo. All report that no such repository can be found.
eblanton commented 6 years ago

Trying to create an assignment without a handout repository, I got an error regarding creating private repositories (because GH approval for Academic use on this org is still pending). Perhaps this is related? I will report back after approval.

BenEmdon commented 6 years ago

Hey @eblanton, thanks for posting such a detailed bug report 👏 If your organization doesn't have private repos you won't be able to search for private repos in the starter code search bar. Once your organization gets approved for private repos you should be able to search for the private repo you are looking for.

If you still have a problem after that feel free to reopen this issue Closing this for now.

eblanton commented 6 years ago

My organization has been approved for an academic coupon, and I still have this problem.

eblanton commented 6 years ago

My organization currently has exactly one repository and no GitHub Classroom assignments -- I would be happy to add a GHC developer to the organization as admin to test this.

d12 commented 6 years ago

Hey @eblanton ,

Which organization are you seeing issues with? We should be able to try to debug this without requiring you to grant admin access to a developer.

Also to be clear, are you seeing issues accepting private invitations, looking up private starter code, or both?

eblanton commented 6 years ago

The organization is ub-cse410bla-f18.

I'm not sure how to answer your other question. I am having trouble creating an assignment using starter code from the same organization. The starter code repository is private.

eblanton commented 6 years ago

I deleted and re-created the classroom to see if this would help, and it did not. I am trying to create a tutorial for students on how to perform their first Classroom / GitHub assignment, and this is holding me up.

d12 commented 6 years ago

Hey @eblanton , I'm ccing @BenEmdon on this issue to help out with looking into it.

Based on a quick investigation, it seems like we're having problems returning private forks in the starter code search. If it's possible to use a repo that isn't a private fork, it should work for you. We're going to look into why this is happening soon.

BenEmdon commented 6 years ago

@eblanton While we look into this there is a work around you can do so that you aren't blocked by this issue.

Work around steps

  1. Create a new public or private repo on GitHub.com on your account or your organization. screen shot 2018-08-01 at 9 42 55 am
  2. Then in your newly created empty repo, go to Import code screen shot 2018-08-01 at 9 43 23 am
  3. Next grab the HTTPS clone URL of the repo or forked-repo you want to find in classroom. screen shot 2018-08-01 at 9 44 33 am
  4. Then paste that into the import URL. screen shot 2018-08-01 at 9 51 17 am

The repo you create and import this way should be visible from classroom. I hope this un-blocks you! Let me know if it doesn't. 😃

eblanton commented 6 years ago

I was unable to complete Step 3 (GitHub kept prompting me for my repo login credentials over and over, stalling for 60 seconds or so before each attempt), but I was able to simply push to the new repo at the command line. So I guess the fork nature of the repo was the problem?

This is an acceptable workaround.

BenEmdon commented 6 years ago

So I guess the fork nature of the repo was the problem?

Forks work, but private forks in particular are sort of an edge case.

This is an acceptable workaround.

Im glad this was able to work for you. On behalf of the classroom team I apologize for the inconvenience.

stale[bot] commented 6 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

BenEmdon commented 5 years ago

@eblanton are we okay to close this issue?

eblanton commented 5 years ago

I don't know, is it fixed? I have a work around that is good for me, but as far as I know the original issue was never addressed.

I guess my answer is that it's up to you, because it's not currently affecting me.

BenEmdon commented 5 years ago

Summary Of Bug

A private fork repository couldn't be found when searching in Classroom's starter code repo search box, preventing the professor/instructor from setting their base repo to be a private fork.

This bug seems to be an edge case with searching for private forks. I'll leave this issue open and rename the issue.

stale[bot] commented 5 years ago

This issue has been automatically marked as stale because it has not had recent activity. Thank you for your contributions.

pinventado commented 5 years ago

I also have the same problem where I can't use a forked private repo as starter code for my GItHub Classroom assignment.

spring-haru commented 5 years ago

Exactly the same problem, which led me to this thread. It would be extremely useful if the bug was fixed.

d12 commented 5 years ago

I am digging into this right now. I'll keep y'all updated.

Right now, it seems https://github.com/education/classroom/blob/bab0ecfccaa23ca4d07aa65a59f7c001f8682b38/app/models/github_repository.rb#L215 does not return private forks, but does return private non-forks. Odd.

d12 commented 5 years ago

This happens when trying to use a private fork of an organization repository that has third party access restrictions enabled. Using a repo forked from a User, disabling third party restrictions on the organization, or authorizing the Classroom oauth app will resolve the issues.

More about third party access restrictions: https://help.github.com/en/articles/about-oauth-app-access-restrictions

As this is a GitHub.com security feature, we can't do much besides offer the workarounds I listed above. Closing the issue!

pinventado commented 5 years ago

I tried checking my organization's Third-Party Access settings that shows that Classroom is authorized.

image

image

Is this what you were referring to? I still have the Third-party application access policy set to "access restricted". Given those settings, I still can't use the forked private repo as starter code for an assignment.

Here's how to replicate:

Some additional notes, I can see the private repo from Organization 1 when I try to use it as starter code for my assignment, but don't see the private forked repo from Organization 2.

d12 commented 5 years ago

Hmmm. Perhaps someone in @education/classroom-reviewers has more ideas. There may be more to this problem than I discovered.