0

When generating my public key for GIT access, I decided to set up a password for it. My push procedure looks like this now:

Enter passphrase for key '/c/Users/USERNAME/.ssh/id_rsa':
Counting objects: X, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (X/X), done.
Writing objects: 100% (X/X), XXXX bytes | 0 bytes/s, done.
Total X (delta 3), reused 0 (delta 0)
To [email protected]:Username/reponame.git
   XXXXX..XXXXXX  branch-name -> branch-name

Does this passphrase really protect anyone for pushing to github, or can this be bypassed?

2 Answers 2

0

What you have created is not a "public key for GIT access" nor is it anything to do with Git itself. It is an SSH key that is used to let you authenticate ("log in") to other hosts on a network via the SSH protocol.

Git has many ways of copying commits and other data from one repo to another, and in this case your git push command is using SSH to log in to GitHub and then copy new data from your repo to a repo stored on GitHub.

When you set this up, you used the GitHub web interface to associate the public key portion of your SSH key to your GitHub account. Thus, anybody who can prove that they have the private key portion of that SSH key can now access GitHub via SSH and authenticate as that GitHub account, and no other. (It's not possible for a key to be associated with two accounts, because GitHub must be able to select a single unique account for any key presented to it.)

So long as nobody else has access to your private key, nobody else will be able access your GitHub account via SSH, whether for pushes or any other operation. The passphrase adds an extra layer of security in that it prevents someone who gets hold of your private key file from using that private key unless they know the passphrase. (But keep in mind that, once they have the file, they can take as many tries as they like to guess the passphrase, which is why it's best to use a quite strong passphrase.)

However, there are a couple of other avenues of access that would allow someone else to change your repo:

  1. Other GitHub accounts can be added as "collaborators" on that project on GitHub, and people who can log in to those accounts will be to change your repo if the collaborator is given write access.

  2. Anybody who can access your account on GitHub via the web can make arbitrary changes to your repo, either through the web interface or by adding another SSH key that would allow them to access your account via SSH.

1

The passphrase is used to encrypt the private key, which prevents it from being used to digitally sign commits. This protects your private key from being abused by an attacker if it becomes compromised (e.g. you accidentally commit your private key to a public repo) unless they can crack your password.

1
  • The key he is talking about there is not used to sign commits.
    – cjs
    Mar 13 at 16:31

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .