Hi Devs, I am new to git and I have some questions about GitHub. Please answer if possible.
Answering the main question the response is "no, it isn't"
About the other questions:
Q1) Can anyone push into my repo if it is public and if I don't set a ssh-key for my account?
No, if your repository is public everybody can clone
it and work on it in his local working copy but none can push new commits on your repository unless you explicitly invite them to (Settings -> Manage access -> Invite a collaborator) and they accept the invitation.
You add a collaborator if he is a member of your team and you want him to work directly on your project (hopefully you share a workflow to use branches properly).
Another way to collaborate is to fork
your project and ask to merge new features / fixes through a pull request
. This is used by external collaborators.
Q2) Using HTTPS url for push and pull is safe or not?
It's safe.
The main difference is that if you work with a remote set with a HTTPS url you need to pass your credentials every time you need a remote operation (push
, pull
, fetch
, ...).
You can save your credentials in a .git-credentials
file in Linux (but you'll have your password stored in a not encrypted text file) or store them in the Credential manager in Windows.
Q3) Why git is not asking for authentication even if I have not set any ssh-key?
If you are performing a clone
you don't need to pass your credentials since your repository is public.
If you are performing a push
the only reason is that you are working on Windows and you already specified your credentials once. Now they are stored in the credential manger (look at the answer to Q2).
Q4) How can I protect my repo from outsiders so that they can only see it and they'll not be able to change it?