The solution was to fix the file permissions. I had changed the permission of the moodle folder recursivly to 755 after install.
I checked with git diff and it told me 644 was the original permission of most files. After fixing this back to 644 I could checkout and upgrade from 3.8 to 3.9.
I checked with git diff and it told me 644 was the original permission of most files. After fixing this back to 644 I could checkout and upgrade from 3.8 to 3.9.