Skip to content

Latest commit

 

History

History
229 lines (149 loc) · 8.86 KB

0-set-up.md

File metadata and controls

229 lines (149 loc) · 8.86 KB

Set-up: installing and configuring git (steps 0.1 through 0.5)

Step 0.1: Registering a GitHub account

If you already have a GitHub account you'd like to use, log in to that account.
Tip: It would be helpful to register Red Hat email id to your GitHub for easy workflow. Add Second Email to GitHub

Otherwise, register a GitHub account at https://github.com/.

At the end of registration, it'll ask you to set up a new repo. You can stop there without setting one up yet.

PACSPull Plugin

Step 0.2: Opening a terminal

The terminal allows you to interact with programs on your computer in a precise and powerful way. We will use it for everything in this workshop.

Linux (Fedora and Ubuntu)

Use ctrl + alt + T to open a terminal or search for terminal in fedora or search for it in the Unity dash in Ubuntu.

MacOS

Go to Applications → Utilities → Terminal to open a terminal.

Windows

You will be using Windows PowerShell. In the Start menu, search for PowerShell.

Step 0.3 Checking git version

On all operating systems, enter the following command in the terminal (type the command and hit ENTER):
git --version

After you enter the above command, you should see something like (although the version number may differ):
git version 2.20.1

If you see this, it means git is installed (skip the next step). If you see nothing, git is not installed and you will need to install it, following the instructions in Step 0.4.

Step 0.4 Installing git (if not already installed)

Linux

Fedora

sudo dnf update
sudo dnf install git

Ubuntu

sudo apt-get update
sudo apt-get install git

MacOS

Use the the Git for Mac Installer.

Alternatively, if you have homebrew installed, you can issue:
brew install git

You can install homebrew with
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
before entering the above command.

Windows

Use the Git for Windows installer.

Step 0.5 Configure git (if not already configured)

Configure git with your name and email. The name can be anything, but the email must match the one tied to your GitHub account (the one you used for registering the account). GitHub uses this for authentication.

On all operating systems, issue this command to check your current git configuration:
git config --list

If the command above doesn't show your name and email, you will need to configure git. To do so, issue the following (make sure to use your real email that was used to create your GitHub account):

git config --global user.name "Jane Doe"
git config --global user.email "[email protected]"

Step 0.6 Configure SSH connection with GitHub (if not already configured)

Using the SSH protocol, you can connect and authenticate to remote servers and services. With SSH keys, you can connect to GitHub without supplying your username or password at each visit.GitHub Docs
If you don't already have an SSH key, you must generate a new SSH key. If you're unsure whether you already have an SSH key, check for existing keys.

Check for existing keys

  1. Open Terminal.
  2. Enter ls -al ~/.ssh to see if existing SSH keys are present:
ls -al ~/.ssh
# Lists the files in your .ssh directory, if they exist
  1. Check the directory listing to see if you already have a public SSH key. By default, the filenames of the public keys id_rsa.pub.

Generate a new SSH key

  1. Open Terminal
  2. Paste the text below, substituting in your GitHub email address.
ssh-keygen -t rsa -C "[email protected]"
  1. When you're prompted to "Enter a file in which to save the key," press Enter. This accepts the default file location.
> Enter a file in which to save the key (/home/you/.ssh/id_rsa): [Press enter]
  1. At the prompt, type a secure passphrase. you can press Enter if choose to not use passphrase.

  2. SSH key is now generated.

Setup SSH Key in GitHub

  1. Copy the SSH public key present in the default location.
/home/you/.ssh/id_rsa.pub (COPY IT)
  1. Add the SSH public key to your GitHub Account.
  • Goto GitHub setting.
  • From the sidebar, select SSH and GPG keys
    PACSPull Plugin
  • Add new SSH Key
    PACSPull Plugin
  • In the Title Field, add a descriptive label for the new key. For example, Red Hat Workstation.
  • Paste the copied SSH public key content to Key Field and Save.
    PACSPull Plugin
  1. Voila! The SSH connection with GitHub is setup.

Step 0.7 Configure commit signature with GitHub (if not already configured)

You can sign your work locally using GPG or S/MIME. GitHub will verify these signatures so other people will know that your commits come from a trusted source. GitHub will automatically sign commits you make using the GitHub web interface.GitHub Docs

GitHub supports several GPG key algorithms. If you try to add a key generated with an unsupported algorithm, you may encounter an error.
RSA ElGamal DSA ECDH ECDSA EdDSA

Check for existing keys

  1. open terminal.
  2. Use the gpg --list-secret-keys --keyid-format LONG command to list GPG keys for which you have both a public and private key. A private key is required for signing commits or tags.
$ gpg --list-secret-keys --keyid-format LONG
/Users/hubot/.gnupg/secring.gpg
------------------------------------
sec   4096R/3AA5C34371567BD2 2016-03-10 [expires: 2017-03-10]
uid                          Hubot
ssb   4096R/42B317FD4BA89E7A 2016-03-10

Generating a new GPG key

Note: Before generating a new GPG key, make sure you've verified your email address.

  1. Download and install the GPG command line tools for your operating system. We generally recommend installing the latest version for your operating system.

  2. Open Terminal,to Generate a GPG key pair. Since there are multiple versions of GPG, you many need to consult the relevant man page to find the appropriate key generation command. Your key must use RSA.

gpg --full-generate-key
  1. At the prompt, specify the kind of key you want, or press Enter to accept the default RSA and RSA.

  2. Enter the desired key size. Your key must be at least 4096 bits.

  3. Enter the length of time the key should be valid. Press Enter to specify the default selection, indicating that the key doesn't expire.

  4. Verify that your selections are correct.

  5. Enter user Id info and secure passphrase

  6. Use the gpg --list-secret-keys --keyid-format LONG command to list GPG keys for which you have both a public and private key. A private key is required for signing commits or tags.

gpg --list-secret-keys --keyid-format LONG
  1. From the list of GPG keys, copy the GPG key ID you'd like to use. In this example, the GPG key ID is 3AA5C34371567BD2:
$ gpg --list-secret-keys --keyid-format LONG
/Users/hubot/.gnupg/secring.gpg
------------------------------------
sec   4096R/3AA5C34371567BD2 2016-03-10 [expires: 2017-03-10]
uid                          Hubot
ssb   4096R/42B317FD4BA89E7A 2016-03-10
  1. Paste the text below, substituting in the GPG key ID you'd like to use. In this example, the GPG key ID is 3AA5C34371567BD2:
$ gpg --armor --export 3AA5C34371567BD2
# Prints the GPG key ID, in ASCII armor format
  1. Copy your GPG key, beginning with -----BEGIN PGP PUBLIC KEY BLOCK----- and ending with -----END PGP PUBLIC KEY BLOCK-----.

Adding the GPG key to GitHub

  1. Goto GitHub setting.
  2. From the sidebar, select SSH and GPG keys
    PACSPull Plugin
  3. Add new SSH Key
    PACSPull Plugin
  4. In the Title Field, add a descriptive label for the new key. For example, Red Hat Workstation.
  5. Paste the copied GPG public key content to Key Field and Save.
    PACSPull Plugin
  6. To set your GPG signing key in Git, paste the text below, substituting in the GPG key ID you'd like to use. In this example, the GPG key ID is 3AA5C34371567BD2:
$ git config --global user.signingkey 3AA5C34371567BD2
  1. Voila! The GPG key is setup with GitHub.