github-education-resources / classroom-assistant

Clone student repositories in bulk
https://classroom.github.com/assistant
MIT License
116 stars 39 forks source link

Repositories cloned with CA expires #103

Open BrianEmilius opened 6 years ago

BrianEmilius commented 6 years ago

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.

johndbritton commented 6 years ago

The token for a repository downloaded with Classroom Assistant expires rather fast

This is by design

I have to download their repo again, because the token has expired. I cannot pull their changes.

This sounds like you'd like the ability to run git pull for each of your student repositories. Is there a reason why deleting the cloned repositories and cloning them again doesn't give you what you need?

BrianEmilius commented 6 years ago

I imagined it was by design, but as part of this ... let's call it a UX issue? - I'd very much like to be able to git pull a student assignment repo. The reason for this is a better workflow as a teacher, having to grade several assignments for a large group of students every single day. I'd have to delete old (expired) repos, go back to classroom.github.com, find the assignment, click download assignments with CA, select the students individually, and then clone them. This seems like an unreasonable amount of steps when the Git workflow is made for pull or rebase in the exact scenario I am describing.

johndbritton commented 6 years ago

This seems like an unreasonable amount of steps when the Git workflow is made for pull or rebase in the exact scenario I am describing.

It would be ideal if we could just run a git pull for each repository, however due to the way authentication is handled, we're not able to pull again without getting a new authentication token.

I'm labeling this as an enhancement that we may address in the future, but for now the only way to get the latest code will be to clone all the repositories from scratch each time.

katriendeleu commented 6 years ago

I'd also like to have the ability to git push. It is my way to give feedback. The students see my commit(s), and they can adjust their excercise. I git pull their new versions and this goes on just until they have solved the whole problem.

dietmarw commented 5 years ago

I solved this by manually changing the origin uri from something like https://<x-access-token:ABCD...>@github.com/username/reponame.git to https://github.com/username/reponame.git

Which is cumbersome for 20+ students.

Surely it should be easy for CA to set the latter URI instead of including the token after successful download.

itmeson commented 5 years ago

I solved this by manually changing the origin uri from something like https://<x-access-token:ABCD...>@github.com/username/reponame.git to https://github.com/username/reponame.git

Which is cumbersome for 20+ students.

Surely it should be easy for CA to set the latter URI instead of including the token after successful download.

I was just about to open a new issue for this when I found this one -- I would like to use CA to push and pull from student repos so I can give feedback and programmatically update files in assignments (using a shell script), which would work without problem if the origin was set by CA as dietmarw suggested.

jteresco commented 5 years ago

I also was about to open a new issue because I am unable to push back up to the repositories on GitHub from the clones created with this tool, but it looks like it's this issue. So I'll just add another voice saying that the clones need to have the same functionality as ones I clone directly or with script-based tools for them to be useful given the way I've been using Git and GitHub for interactions with students during their development and at grading time.

keithmannock commented 5 years ago

I would also like to echo those sentiments as "push"ing back to the student repos is the way I return feedback to them.

MsJAHarris commented 5 years ago

Agreed, I want the ability to push back any inline comments I have made and any "fixes".

hdsbbrooks commented 5 years ago

Agreed with the above, being able to push back feedback is important. I have been changing the URI manually as @dietmarw mentions but it's un-necessary work.

brockcraft commented 5 years ago

Yet another +1 for being able to push back the repos once we've made commetns/suggestions. This seems like key functionality for providing students feedabck.

johndbritton commented 5 years ago

@srinjoym @mozzadrella something worth considering.

neumannm commented 5 years ago

Please consider adding the functionality to push back into these repos :+1:

kurmasz commented 5 years ago

Why is Classroom Assistant even using a temporary token in the first place? Why can't it just use my ssh keys and set the origin URI accordingly?

BrianEmilius commented 5 years ago

Any news on this enhancement request?

alvaromonge commented 5 years ago

Agree that this functionality is needed... @mozzadrella what say you?

ADWolfe-LoyNO commented 5 years ago

I'm really flabbergasted at the suggestion that repeated fresh clones are a useful workflow for teaching. That's no better than Blackboard.

I have no idea just who wants to use Classroom Assistant to clone without ever pushing or re-fetching—that is, who wants to use GitHub CA without actually using git—but for the rest of us, can you please set up an option for Classroom Assistant to use the credential store and skip those useless tokens?

colm-connaughton commented 5 years ago

As another user who would like to use git push to provide feedback, I would like to add my voice to those above.

johndbritton commented 5 years ago

I'm no longer working at GitHub but wanted to shed some light on the rationale that was used at the time of designing this feature.

The primary goal of Classroom Assistant is to help teachers download student work to disk in bulk.

There are a lot of security issues to take into consideration, and after careful research the path of using temporary cloning tokens was selected as the safest option to also achieve the goals. This was to avoid giving Classroom Assistant access to any repositories outside of the scope of GitHub Classroom.

An alternative design would have been to give Classroom Assistant tokens to access repos that you as the teacher have access to. This was not ideal, because those tokens would have access to any repository on GitHub that you have access to and would include write access.

Further :+1: comments aren't helpful. What is helpful is for you to articulate what you are trying to achieve and how that would help in your day to day workflow.

When I marked this as an enhancement I had a solution in mind. That would be to implement an update button in Classroom Assistant that will do a pull for all of the repositories with a fresh temporary token.

We did not consider the case of teachers wanting to push to all student repositories in bulk for Classroom Assistant. If you'd like to further discuss that feature, I'd suggest opening a separate issue.

Pushing to every repo seems to be beyond the scope of Classroom Assistant because there's no easy way to push to every repo that has been edited from the template by your students and avoid conflicts.

My opinion on pushing to every repo is that it should be a feature of GitHub Classroom, not of the Classroom Assistant desktop application.

cc/ @mozzadrella

BrianEmilius commented 5 years ago

Hi @johndbritton

Thanks for that explanation! I absolutely understand (at least, I think I do) the concerns you've outlined and I can see how it presents real issues to the workflow I would love to be able to use. The update button in the desktop client seems like a very nice feature. I think I will do an issue on that. I can see where it would come in handy.

That only leaves the question of how to push (not in bulk, necessarily) to each individual student assignment repo with feedback when they have been downloaded with the assistant client.

HuxyUK commented 5 years ago

If the cloned repositories set the origin URL to the repository address instead of just adding a token URL, your normal username and password would work fine. At the moment I have a script that automatically adds a remote URL and pushes changes using that. My username and password is set for the session, meaning I don't have to keep entering it.

gcschmit commented 5 years ago

As @HuxyUK shared, you can set the origin URL to make all of this work with some added steps. I have a couple of scripts that are specific to my workflow involving Canvas that may be useful:

https://github.com/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.

johndbritton commented 5 years ago

If the cloned repositories set the origin URL to the repository address

I think this is a valid feature request as well, set the origin remote repo to the correct github URL after the repo is cloned using the temporary token. Perhaps that should be a separate issue as well.

I think the main goal of this issue is a refresh button that updates the already cloned repos.

johndbritton commented 5 years ago

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.

@gcschmit 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.

I think there's an issue somewhere to add a grade assignment button to submissions in classroom that would open a pull request of the student's work against an empty commit, essentially giving a diff with line by line comments of every bit of code submitted. Also I think beyond the scope of this issue.

eothein commented 4 years ago

We use github classroom assistent to download group projects in bulk. We review their code every week, so as to give feedback using the "Issues" of GitHub. Hence, I would like to perform git pull every week on the repo to (i) see their progress and (ii) see the log of the commits they have made so far.

meech-ward commented 4 years ago

There might be a more elegant solution, but here's a quick and dirty bash script that will change the remote url and allow you to push and pull:

git remote set-url origin $(git remote -v | head -n 1  | grep -o 'github\.com.*git' | awk '{print "https://"$1}')

Just run that on every repo.

paulsmithkc commented 4 years ago

The token for a repository downloaded with Classroom Assistant expires rather fast

This is by design

I have to download their repo again, because the token has expired. I cannot pull their changes.

This sounds like you'd like the ability to run git pull for each of your student repositories. Is there a reason why deleting the cloned repositories and cloning them again doesn't give you what you need?

The biggest issue here, is that we lose all of the local configuration and compilation that we had to do after downloading the assignment, to get it to the point where we could test and grade it.

Towards the end of the semester, this also means redownloading several gigabytes of data that you have already downloaded previously.

d12 commented 4 years ago

The solution here https://github.com/education/classroom-assistant/issues/103#issuecomment-570954993 resolves this issue, in a hacky way. I'll leave this issue open for now, Classroom Assistant should replace the remote after we finish cloning.

danielnemenyi commented 3 years ago

I've put this together into a script to bulk fix, pull and push a directory-full of Classroom repos, based on @meech-ward 's script. Hope it's useful to others!

tedMcleod commented 2 years ago

I was shocked that CA didn't have a way to at least pull all the repos it had cloned. I cloned all their repositories and then set up the projects in eclipse. Then I found out I couldn't pull. This makes no sense. I was able to work around it by using a modified version of the script danielnemenyi provided (I only wanted it to pull all the repos, not push anything).

maubuz commented 2 years ago

I'm having problems adding comments to student's Pull Requests due to this token expiration. I've installed the Github Pull Requests and Issues extension and after closing the students repos with CA, I would like to add comments to their PR as described in the article Working with GitHub in VS Code.

If I remember correctly, acout 3 weeks ago I was able to leave comments to the automatically created "feedback" Pull Request. However, this is a team project and each student in the team is opening a separate PR. Has anyone else run into this?

I also used a modified version of @danielnemenyi 's script, however, I feel like being able to leave PR comments is a fundamental feature when using Github Classrooms.

NuttKatyISD commented 1 year ago

There might be a more elegant solution, but here's a quick and dirty bash script that will change the remote url and allow you to push and pull:

git remote set-url origin $(git remote -v | head -n 1  | grep -o 'github\.com.*git' | awk '{print "https://"$1}')

Just run that on every repo.

Thanks for this. Worked perfectly. I ended up adding the following to my .bashrc file so that I just have to punch in ghrepull to save copying and pasting.

ghrepull() {
        git remote set-url origin $(git remote -v | head -n 1  | grep -o 'github\.com.*git' | awk '{print "https://"$1}')
        git pull
}