Can running
git add .
git commit -m "message"
in a git repo which you've initialized using
git init
ever result in your code being sent to a repo that is not yours? I am concerned because I did this while not logged in to my git hub account.
Doing a
git commit
locally won't result in your code being sent to any repo, let alone a repo which is not yours. When you do agit commit
, Git will add some local objects corresponding to the changes you have made in the current working branch.In order for code to leave your local machine, you would need to issue a
git push
, which by default will try to send themaster
branch to whatever remote is contained inorigin
.Even if you accidentally did a
git push
to an unknown repository, it would most likely be rejected for many reasons. First, in the case of GitHub, you would not have to rights to make the push. Even if you somehow did have the right to push, either the branch names might not be the same, or it would be rejected as not being a fast forward.Git has many safeguards to prevent this sort of thing from happening.