I am trying to make changes to a GitHub repository for which I have been invited as a collaborator. I can create new files and modify them, but when I try to make any changes to an existent file, I see this message saying:
You must be on a branch to make or propose changes to this file
Then only after I push a commit through the terminal, I am able to modify this file on GitHub. Is this an expected behavior?
It sounds like the repository you're using has protected their main branch (usually master
). This is usually because they want changes to be done with a pull request-based workflow to ensure code review and CI cleanliness before merging.
When you create a branch on the command line and push it, you should be able to modify it as normal, since it's not a protected branch. Similarly, if you create a branch through the UI, you should also be able to edit it. However, you won't be able to push directly to the main branch or edit it directly in the UI.