What is GitHub, and How to Install it on Mac based system chips such as Ultra ?
GitHub as we all know, is an online cloud storage for codes (programming codes), which enables developers to create, manage, and store their codes, while giving them the flexibility to collaborate with one another.
Developers, Security Researchers, Penetration Testers, IT professionals, and more , can view these codes, pull, clone, and contribute to these repositories if they are made public, by the author and owner of the GitHub repository.
HERE IS HOW TO SETUP GITHUB REMOTE PUSH VIA SSH ON YOUR MAC:
To get GitHub setup on your MacBook, Mac Intel, Ultra, and Ultra-2 chip-based computer, here are the simple steps you should follow.
STEP-01:
Open your terminal and type the command below to check if there are instances of ssh installed on any mac you are using.
ls -al ~/ .ssh
reason is to ensure that we do not override existing ssh configuration running on your computer. If there are no ssh configuration created, execute the command in “Step 2”, otherwise skip to “Step 3”.
STEP-02:
If there are no instances of SSH, then you are required to create ssh on your mac. This can be achieved, by typing the command below.
mkdir ~/ .ssh
The command above, will enable us to create or make an SSH directory, on our local machine.
STEP-03:
Next, we want to generate our SSH keys. To do so, type the command below. Replace the email “[email protected]” in the parathesis, with the email associated with your GitHub account.
ssh-keygen -t ed25519 -C “[email protected]”
STEP-04:
After executing the command in “STEP-03”, you will be prompted to provide the path you want your ssh keys to be stored. These ssh keys comprises of both the “private keys & public keys (which are both stored in the ssh directory of your Mac computer), and the public key (you will be inserting in the ssh tab of your GitHub account).
To achieve this, type the path below, replace “fixitgearwaresecurity” with the name of your computer or user account, and “labfile01” with the name of your choice, you want the command to name your “ssh-keys (both public and private keys). After this is done, hit the “enter” key on your keyboard.
/Users/fixitgearwaresecurity/.ssh/id_ed25519_labfile01
N.B: “fixitgearwaresecurity” would be the name of the current user or user account of your mac computer.
STEP-05:
When that is done, you will be asked to provide a paraphrase, this paraphrase is like a password, to provide additional protection layer and security for your GitHub SSH login.
Provide a strong paraphrase and store it somewhere only you can access it, as you would be prompted from time to time to provide the paraphrase, why trying to login or clone a repository.
STEP-06:
Now we are done doing the first Five(5) stages of the configurations, next we want to do, is to get our SSH agent running. To do that, we type the command below.
eval "$(ssh-agent -s)"
If these steps have been properly executed, we should be having agent running with the “pid (process id)” and number.
STEP-07:
The next stage is to add your ssh keys to apple-key chain. To do so, type the command below.
ssh-add --apple-use-keychain ~/.ssh/id_ed25519_labfile01
remember “labfile01” is the name of your ssh key files, you created in “STEP-04”.
STEP-08:
You will be prompted to enter your paraphrase, provide the same paraphrase created during the “Step-05” stage.
STEP-09:
We are required to setup a configuration. This enables your host system (your computer), to communicate with GitHub remotely via the SSH each time we try to establish a connection, by accessing these ssh keys stored in the Keychain on your mac computer.
To setup the configuration, we must first create the configuration file. This can be achieved or created using the command below:
touch ~/.ssh/config
STEP-10:
Next you are required to edit this configuration file, to insert some configuration commands. To edit the configuration file, we just created, type the command below.
nano ~/.ssh/config
STEP-11:
In the edited configuration file, type the command below. Remember to replace the “labfile01” with the name of your ssh key file, created in “STEP-04”.
Host * AddKeysToAgent yes UseKeychain yes IdentityFile ~/.ssh/id_ed25519_labfile01
STEP-12:
To save the command in the edited “config” file, hold “ctrl+x” keys together on your keyboard. When prompted to save changes, type “Y or Yes”, and hit enter.
STEP-13:
Now we need to get our “ssh public key” inserted in our GitHub Account on the web. But first we must get the content of this public key.
To get the content of the public key, type the command below.
nano ~/.ssh/id_ed25519_labfile01.pub
Once again, remember to replace the “labfile01” with the name of your ssh key file, from “STEP-04”.
STEP-14:
Copy the entire content from the edited public key file in “Step-13”, and head over to GitHub, via your web-browser.
STEP-15:
Go to settings on GitHub on your web-browser, scroll down to “SSH and GPG keys” and select it. On the broad interface, select “Add SSH Key”.
STEP-16:
Paste all the content you copied from “STEP-13”, and paste it the SSH textbox field, for Title give it a name you can remember, as in the future you certainly would be adding more public keys. After this has been done, save the entire content.
STEP-17:
To test if our connection is active and working, go to your GitHub repository, copy the specific repo link you want to clone, and then go back to your mac where the entire configuration has been carried out and run the command below.
git clone link_your_repository_you_desire_to_clone
For example:
git clone https://github.com/fixitgearware/NIST-CYBERSECURITY-FRAMEWORK-V1.1.git
Your repository should successfully clone to the directory you are located in. To ensure you are not confused as to where the repository was cloned to, it is advisable to navigate to your desktop first or any directory you want before running the command above. To navigate to any directory of your choice, use the command below:
cd name_of_directory
for example: cd Desktop
will change our directory to the desktop, you can then run the “git clone link_your_repository_you_desire_to_clone”
Put your comments below in the comment section on your thoughts about this.