Editing files as a collaborator on GitHub

删除回忆录丶 提交于 2021-02-07 11:58:16

问题


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 tried to do any changes to an existent file I saw 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 was able to modify this file on the GitHub pages. Is this an expected behavior?

Thanks for your time, Cheers


回答1:


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.




回答2:


I got it:

I came to the source file using the search, hence the result I got was on a specific commit:

https://github.com/organisation/repo/blob/252e66a59e1b717df6b4467e4de025fcfd254a88/pages/file.ext

Changing the tree to the master branch: restores the ability to edit the file.



来源:https://stackoverflow.com/questions/55299930/editing-files-as-a-collaborator-on-github

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!