Git error: Unable to append to .git/logs/refs/remotes/origin/master: Permission denied

This looks like you ran git as root locally, thus changing ownership on some of the files tracking the location of the origin branch.

Fix the file ownership, and you should be fine:

# run this from the root of the git working tree
sudo chown -R "${USER:-$(id -un)}" .

Let's concentrate on what it's complaining about exactly:

Permission denied error: Cannot update the ref 'refs/remotes/origin/master'.

Before doing recursive mod/ownership changes, traverse your way to that file and fix any permissions that are incorrect.

I think I caused this issue by creating a branch while I was root and then trying to mess with that branch as my user.