#Day41 of #100DaysOfCode
Today was a long and tiring day… We trekked to Arthur Seat which is 250.5m above ground level but not an easy path… its an upward slope that felt like ages to finish…
Some highlights of another great day:
I studied a bit of basic of Git and set up and SSH Key on Github Account so that I can push code without entering username password every time
Configure Git and Github
I noticed I already had git
installed, verified version by running git --version
and I have 2.24.0
installed.
linking local git user to Github account is important. This helps identify the person who is making changes when you are working in a team.
git config --global user.name "Your Name"
git config --global user.email "yourname@example.com"
To enable colorful output with git
type
git config --global color.ui auto
The following commands can be used to verify details:
git config --get user.name
git config --get user.email
Creating an SSH Key
An SSH key is a cryptographically secure identifier. It’s like a really long password used to identify a machine. GitHub uses SSH keys to allow uploading to a repository without having to type in a username and password every time.
To check if the Ed25519 algorithm SSH key is already been installed., type following command into the terminal and check the output:
ls ~/.ssh/id_ed25519.pub
If the console message contains “No such file or directory”, then there is no Ed25519 SSH key and will need to be created.
To create a new SSH key, run the following command. The -C
flag followed by your email address ensures that GitHub knows who you are.
Please note: <>
brackets are only placeholder and not added
ssh-keygen -t ed25519 -C <youremail>
- When it prompts for a location to save the generated key, just push
Enter
.
- Next, it will ask for a password; enter one if you wish, but it’s not required.
Link SSH Key with Github
Github needs to know what the SSH key is so the code can be uploaded without needing the password. Log into GitHub and click on the profile picture in the top right corner. Then, click on Settings
in the drop-down menu.
Next, on the left-hand side, click SSH and GPG keys
. Then, click the green button in the top right corner that says New SSH Key
. Give a descriptive name to the key.
Run the following command on terminal to get the public SSH Key:
cat ~/.ssh/id_ed25519.pub
Highlight and copy the output, which starts with ssh-ed25519
and ends with the email address. Now, add this key back to GitHub in your browser window into the key field. Then, click Add SSH key
. You’re done!
Testing the Key
Follow the directions in the Github article to verify the SSH connection.
That is the end for today folks