The solution is to add changes once with a git command.
Use terminal and navigate to Xcode project folder. If you are in the right folder, this command:
ls -al
will list a .git folder. Then you know you’re at the right place. Then execute
git commit -a -m "Commit title here"
After that commit via Xcode should work again.