

With your key pair generated, the next step is to tell Git which private key to use to sign your commits. Use of the -global parameter sets the specified name / e-mail address as the default for all Git repositories on your machine however you may omit the parameter in order to set your name and e-mail address on a per-repository basis. Tower, you may have entered this information into the client which will have executed these commands on your behalf. If you use a visual Git client rather than the command line e.g. git config -global user.name "John Appleseed" git config -global user.email you have not yet set up Git on your machine, you will need to run the above commands substituting in your own name and e-mail address. These are the details you specified when you initially set up Git on your machine using the git config command e.g. Make sure to enter the name and e-mail address you will be committing to Git under. Open GPG Keychain and select New.Ī dialogue box prompting you to enter your name, e-mail address and a passphrase to protect your public / private key pair will be shown as follows: GPGSuite provides a tool called GPG Keychain which can be used to achieve this. With GPGSuite installed, the next step is generate a pair of cryptographic keys - one public which will be uploaded to our version control server and another private which will be held locally on your machine. Crucially, GPGSuite allows us to store the passphrase for our GPG private key in the macOS Keychain meaning that we won’t have to type it out each time we commit to our repository.
#Gpg suite tutorial download
The quickest way to get started signing your commits on macOS is to download a copy of GPGSuite, a set of tools for signing files and messages on macOS. For the purposes of this article, we’ll be focussing on signing commits using GPG as is more common.

Two popular methods of signing commits include GPG and S/MIME.
#Gpg suite tutorial code
By signing commits we can verify that the code committed was actually written by the author named on the commit.

The solution to this problem is to cryptographically sign commits submitted to the remote repository. This may not be a big deal if your remote Git repository is privately hosted with access strictly controlled however if you commit to a popular open source project with many contributors it could be feasible to masquerade as another contributor, say someone who is well-known and trustworthy in order to sneak miscreant code into the project. Did you know though that whilst your credentials identify you to the remote server (and thus determine the actions you may perform within the remote repo), they do nothing to identify your commits as belonging to you? Try changing your Git name and e-mail address to those of someone completely different as follows: git config -global user.name "John Appleseed" git config -global user.email the same SSH keys, you will have the same level access to the repository as you had before and will be able to push commits (providing you had this level of access before) under the the new identity you have switched to.
#Gpg suite tutorial password
Alternatively, you may use a username and password to access your remote repository over HTTPS. If you are a developer using Git as part of your workflow on a regular basis then you’re probably familiar with the concept of using SSH keys to push commits to a remote repository (if you use a URL of the form ssh://) potentially hosted on GitHub, GitLab, Bitbucket etc.
