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