πŸ–₯️
Dev Bible
  • Getting Started
    • πŸ‘‹Introduction
    • πŸ‘¨β€πŸ‘©β€πŸ‘§β€πŸ‘§Meet The Team
    • πŸŽ‰Setting Up Your Workspace
    • πŸ‘¨β€πŸŽ“Recommended Courses
    • πŸͺ΄Environments
    • 🎯Coding Best Practices
    • πŸ‘©β€πŸ’»Awesome AWS
    • 🐍Awesome Python
  • Security
    • πŸ§˜β€β™‚οΈZen of Security
    • πŸ’‘Man in the Middle (MITM) Attacks
    • 🧰Cryptographic Tools
      • πŸ•ΆοΈSSH KeyGen and Agent
      • πŸ₯·GNU Privacy Guard (gpg)
    • πŸ•΅οΈAuthentication
      • πŸ–₯️EC2
      • πŸ‘ΎGitHub
    • 🎟️Authorization
      • πŸ¦Έβ€β™‚οΈSingle Sign-On
      • πŸ†”Identity and Access Management
    • πŸ”Tamper Resistance
      • πŸ“Git Commits
    • πŸ“šReference Materials
  • Consulting
    • ✨Event-Driven Architecture
      • πŸŒ„Day 1
      • πŸŒ…Day 2
    • πŸ“šReference Materials
    • πŸ“₯/tmp
Powered by GitBook
On this page
  1. Security
  2. Authentication

GitHub

Accessing the remote repositories.

PreviousEC2NextAuthorization

Last updated 11 months ago

Git Repositories (GitHub)

Follow on GitHub.

  1. Create your ssh-key using:

ssh-keygen -t ed25519 -C "your_email@example.com"

2. Navigate to .ssh folder. When prompted to name the key, name it github_pz

3. Leave the password empty and press enter.

Your terminal will look similar to what is shown below if done correctly:

Generating public/private ed25519 key pair.
Enter file in which to save the key (/home/ec2-user/.ssh/id_ed25519): kenny_test
Enter passphrase (empty for no passphrase): 
Enter same passphrase again: 
Your identification has been saved in kenny_test.
Your public key has been saved in kenny_test.pub.
The key fingerprint is:
SHA256:plQlDgcUU4GxBZKm2njKu+f+s9cf7Y32UF4JDLyad1M your_email@example.com
The key's randomart image is:
+--[ED25519 256]--+
|    .oOB*.o.     |
|    o..B o .o    |
|   o  . o   .o   |
|  .    .   .  .E.|
| +    . S o   .o.|
|o o  . o o ..oo .|
|.o    . . ...o.. |
|.. . . . .  o.+  |
| o*o.o+   ...o.o |
+----[SHA256]-----+

You will see two files stored in the location where you generated the file. Open both if you are not sharing your screen and you are in a secure environment. Become familiar with the difference between the private and public key. ONLY SHARE YOUR PUBLIC KEY!

4. Give your public key to the administrator to issue a CA for access to the repository.

5. Go to your own GitHub account and add the same public key.

Add files called allowed_signers and config to the ~/.ssh directory and update permissions to limit to read/write for user only.

touch ~/.ssh/allowed_signers
chmod 600 ~/.ssh/allowed_signers
touch ~/.ssh/config
chmod 600 ~/.ssh/config

Add the following to that config file:

Host your-alias-domain.com
HostName github.com
PreferredAuthentications publickey
IdentityFile ~/.ssh/your-private-key

Start the SSH agent

eval "$(ssh-agent -s)"

Now add your private key to the SSH agent

ssh-add ~/.ssh/your-private-key

Test if it was added with

ssh-add -l

Now add your user name and email to the git configuration (unless it's already set).

git config --global user.name "your-user-name"
git config --global user.email "your-email"

Once complete, test your login using

ssh -T git@your-alias-domain.com
πŸ•΅οΈ
πŸ‘Ύ
these steps