Can anybody push to my project on github?

GitGithubPush

Git Problem Overview


I am new to git as well as github. I set up a repo on github, and I can push local stuff to this remote repo. Now here is the question: just after I push something to the remote repo, and I refresh the page, I can see the changes are uploaded(for example, if I wrote a readme.txt and push it to the remote repo, where such a readme.txt did not exist, after push and refresh the page, it appears).

So can anybody change my repo on github freely? Or if I push something to linux kernal, can the changes I made be added to it and public for all?

Git Solutions


Solution 1 - Git

No, all repositories are read-only for anonymous users. By default only the owner of the repository has write access. If you can push to your own repo, it's because you are using one of the supported authentification methods (HTTPS, SSH, ...).

If you want to grant someone else privileges to push to your repo, you would need to configure that access in the project settings.

To contribute to projects in which you don't have push access, you push to your own copy of the repo, then ask for a pull-request. Linux is not a good example for that, because the kernel developers do not use GitHub pull requests.

Solution 2 - Git

No, but if the repository is public others can fork it, commit to their own fork.

They can then ask you to pull some of the changes in their fork into your repository via a pull-request.

Solution 3 - Git

Nobody can push directly to your repository if you are not already granting them write access.

The process for contributing to a public repository in GitHub starts by forking the repository, then pushing the change onto the forked, then creating a pull request onto the original repository. After that comes the role of the project owner to review and take action (merge/decline) of the requested code change.

For more details, please check the below helpful article:

https://akrabat.com/the-beginners-guide-to-contributing-to-a-github-project

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionSilveryView Question on Stackoverflow
Solution 1 - GitSébastien DawansView Answer on Stackoverflow
Solution 2 - GitEinarView Answer on Stackoverflow
Solution 3 - Githd84335View Answer on Stackoverflow