πŸ‘ΎGitHub

Accessing the remote repositories.

Git Repositories (GitHub)

Follow these steps 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

Last updated