WeBWorK Main Forum

"Couldn't find branch in remote origin" error message

Re: "Couldn't find branch in remote origin" error message

by Larry Riddle -
Number of replies: 4

Glenn, thanks so much for your help here. Greatly appreciated.

Running "git fetch" in the webwork2 directory resulted in

wwadmin@swoop:/opt/webwork/webwork2$ git fetch
remote: Enumerating objects: 4448, done.
remote: Counting objects: 100% (1488/1488), done.
remote: Compressing objects: 100% (44/44), done.
remote: Total 4448 (delta 1444), reused 1475 (delta 1443), pack-reused 2960
Receiving objects: 100% (4448/4448), 2.60 MiB | 17.49 MiB/s, done.
Resolving deltas: 100% (3484/3484), completed with 321 local objects.
From https://github.com/openwebwork/webwork2
   48b9feadd..488d48e77  main         -> origin/main
 * [new branch]          WeBWorK-2.17 -> origin/WeBWorK-2.17
error: cannot update the ref 'refs/remotes/origin/develop': unable to append to '.git/logs/refs/remotes/origin/develop': Permission denied
 ! 9bdbc1c5b..2d69c283e  develop      -> origin/develop  (unable to update local ref)

Running "git fetch" in the pg directory resulted in

wwadmin@swoop:/opt/webwork/pg$ git fetch
remote: Enumerating objects: 1177, done.
remote: Counting objects: 100% (490/490), done.
remote: Compressing objects: 100% (7/7), done.
remote: Total 1177 (delta 482), reused 484 (delta 482), pack-reused 687
Receiving objects: 100% (1177/1177), 1.72 MiB | 14.96 MiB/s, done.
Resolving deltas: 100% (716/716), completed with 131 local objects.
From https://github.com/openwebwork/pg
   b44b71e8..1b0b5ecd main       -> origin/main
 * [new branch]      PG-2.17    -> origin/PG-2.17
error: cannot update the ref 'refs/remotes/origin/develop': unable to append to '.git/logs/refs/remotes/origin/develop': Permission denied
 ! 8addfac0..7d3bad2e develop    -> origin/develop  (unable to update local ref)

So I assume than means the commands worked. I'm not sure if the reported error in both cases is critical. The permissions on develop are "-rw-r--r-- 1 root    root    581 Jul 23  2021 develop". That date is when I upgraded from 2.15 to 2.16.

But when I log into the course administration course as admin, I still get

The following upgrades are available for your WeBWorK system:
Couldn't find WeBWorK Branch main in remote origin
Couldn't find PG Branch main in remote origin
Couldn't find OPL Branch main in remote origin

so the changes I've made (so far) do not seem to have resolved that issue. In addition, WeBWorK also gives the warning
Argument "" isn't numeric in numeric gt (>) at /opt/webwork/webwork2/lib/WeBWorK/ContentGenerator/CourseAdmin.pm line 3453.

which seems to be due to not being able to find the OPL branch.

In reply to Larry Riddle

Re: "Couldn't find branch in remote origin" error message

by Glenn Rice -

It sounds like you have some permissions issues in your .git subdirectories.  Most likely that is the result of running a git command as root.  You should never do that.  To fix that run
     sudo chown -R wwadmin:wwadmin .git
in both the /opt/webwork/webwork2 and /opt/webwork/pg directories.

What is the output when you run:
    git log -1 --pretty=format:%at
in /opt/webwork/libraries/webwork-open-problem-library

Also, what is the output when you run:
    ls -l /opt/webwork/webwork2/htdocs/DATA


In reply to Glenn Rice

Re: "Couldn't find branch in remote origin" error message

by Larry Riddle -
Permissions fixed. Thanks.

wwadmin@swoop:/opt/webwork/libraries/webwork-open-problem-library$ git log -1 --pretty=format:%at
1629407085

wwadmin@swoop:/opt/webwork/libraries/webwork-open-problem-library$ ls -l /opt/webwork/webwork2/htdocs/DATA
total 1208
-rw-rw-r-- 1 wwadmin wwadmin 155276 Dec 30 2020 library-directory-tree.json
-rw-rw-r-- 1 wwadmin wwadmin 169639 Dec 30 2020 library-subject-tree.json
-rwxrwxr-x 1 wwadmin wwadmin 70 Jun 23 2015 README
-rw-rw-r-- 1 wwadmin wwadmin 58121 Jul 24 2021 tagging-taxonomy.json
-rw-rw-r-- 1 wwadmin wwadmin 843770 Dec 30 2020 textbook-tree.json

I just reran the git fetch command in webwork2 and pg, and now the result is

wwadmin@swoop:/opt/webwork/webwork2$ git fetch
From https://github.com/openwebwork/webwork2
   9bdbc1c5b..2d69c283e  develop    -> origin/develop

wwadmin@swoop:/opt/webwork/pg$ git fetch
From https://github.com/openwebwork/pg
   8addfac0..7d3bad2e  develop    -> origin/develop
In reply to Larry Riddle

Re: "Couldn't find branch in remote origin" error message

by Glenn Rice -

Are you still getting the messages about not being able to find the branch main in the remote origin in the webwork2/admin course?  I suspect that you are.  In fact, that is all anyone is ever going to get from the webwork2 update notification from now on it seems.  Looking closer at this, it seems that the approach that has been used of having the server execute git commands to determine if upgrades are available is dead in the water.  The server user (usually www-data on Ubuntu) can not run git commands on a repository it does not own.  This is something that has changed recently with git.  There may be workarounds to make it work, but none of them are secure.

I recommend that you disable webwork2 upgrade notifications.   Set "$enableGitUpgradeNotifier = 1;" in localOverrides.conf.

In reply to Glenn Rice

Re: "Couldn't find branch in remote origin" error message

by Larry Riddle -

Yes, I was still getting the messages, but I did turn off the upgrade notifications (I think you meant to write setting it equal to 0, not 1) and now they are gone.

Thank you again, Glenn, for all your help and suggestions.