Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

If some one knows my Github username and email, can they commit or push the files of my project?

I am new to Git. I opened Github account, created a public repository, and set up the username and email, as indicated by Github's tutorial. So if anyone knows my username and email, can they commit or push the files in my public repository?. How can I protect the files?. SVN having username password for commit the files. How can I do that?

like image 214
Bala Avatar asked Oct 21 '25 04:10

Bala


2 Answers

No, somebody can only commit to your repository if you do one of several things:

  • Give them your ssh secret key or GitHub password. This is a very bad idea, and should never be done.
  • Add their ssh public key to your GitHub account. This would allow them to push to any of your GitHub repositories until you remove that key. Much better option than the previous, but still something to only do after careful thought.
  • Add that person's GitHub account as a collaborator on your repository. This would be the recommended way to allow somebody else to push changes into your repository.

But, for any public repository anybody can view the files in the web interface or clone the repository. Also, any GitHub account can fork the repository and send pull requests.

like image 156
qqx Avatar answered Oct 23 '25 18:10

qqx


The setup that you do is for github to identify your commits as, well, being yours. But for the commits to be actually pushed to your repository, the person will need access to either your github password or access to your ssh private key.

Without those, no one can push to your repository.

This also means that, anyone can commit using your email and username and push to the repos they have access to. You can do the same too.

like image 40
manojlds Avatar answered Oct 23 '25 20:10

manojlds