ASU-CompMethodsPhysics-PHY494 / PHY494-assignments-skeleton

Homework assignments and layout for the private assignment repos.
1 stars 6 forks source link

update.sh: fatal: refusing to merge unrelated histories #8

Closed orbeckst closed 4 years ago

orbeckst commented 4 years ago

If you followed the instructions to clone your private homework repository and ran the command

bash ./scripts/update.sh

and you don't see assignment03 then look carefully at the output: If it looks like the following

$ ./scripts/update.sh
Adding remote repository 'skeleton'.
updating repository... git pull from skeleton
warning: no common commits
remote: Enumerating objects: 45, done.
remote: Counting objects: 100% (45/45), done.
remote: Compressing objects: 100% (34/34), done.
remote: Total 65 (delta 16), reused 35 (delta 11), pack-reused 20
Unpacking objects: 100% (65/65), done.
From https://github.com/ASU-CompMethodsPhysics-PHY494/PHY494-assignments-skeleton
 * branch            master     -> FETCH_HEAD
 * [new branch]      master     -> skeleton/master
fatal: refusing to merge unrelated histories
creating subdirectories (if any are missing)
created assignment_01/Grade
created assignment_01/Submission
created assignment_01/Work
created assignment_02/Grade
created assignment_02/Submission
created assignment_02/Work

you may note the lines warning: no common commits and fatal: refusing to merge unrelated histories . These are serious issues that result in you not getting the assignment that is available in the skeleton repository.

orbeckst commented 4 years ago

I am currently looking into why this error occurs but a work-around is the following: run the following command once

git pull --allow-unrelated-histories https://github.com/ASU-CompMethodsPhysics-PHY494/PHY494-assignments-skeleton.git master

and afterwards bash ./scripts/update.sh will work as it should.

orbeckst commented 4 years ago

(One possibility is that for this year we are using the template functionality to have the private repos created by Classroom – maybe that makes the histories diverge?)

ChenouZhang commented 4 years ago

Just tried to create my test folder following the above instructions. I got:

$ bash update.sh
Adding remote repository 'skeleton'.
updating repository... git pull from skeleton
remote: Enumerating objects: 45, done.
remote: Counting objects: 100% (45/45), done.
remote: Compressing objects: 100% (34/34), done.
remote: Total 65 (delta 16), reused 35 (delta 11), pack-reused 20
Unpacking objects: 100% (65/65), 522.76 KiB | 964.00 KiB/s, done.
From https://github.com/ASU-CompMethodsPhysics-PHY494/PHY494-assignments-skeleton
 * branch            master     -> FETCH_HEAD
 * [new branch]      master     -> skeleton/master
creating subdirectories (if any are missing)
created assignment_01/Grade
created assignment_01/Submission
created assignment_01/Work
created assignment_02/Grade
created assignment_02/Submission
created assignment_02/Work
created assignment_03/Grade
created assignment_03/Work

Seems fine. I created the repo directly not from the Classroom.

orbeckst commented 4 years ago

Students cannot create repositories in the GitHub org, they must use Classroom.

But your comment is useful because it suggests that there is a problem with the fork/template approach in Classroom and my assumption that they get a clone with a common history.

orbeckst commented 4 years ago

Idea: change update.sh to do the git pull --allow-unrelated-histories the first time round (or if git pull fails)

orbeckst commented 4 years ago

Background reading on GitHub template repos