SETTING UP GIT AND GITHUB - GIT FUNDAMENTALS

SETTING UP GIT AND GITHUB - GIT FUNDAMENTALS

SETTING UP GIT AND GITHUB - GIT FUNDAMENTALS

SETTING UP GIT AND GITHUB - GIT FUNDAMENTALS

As a full stack developer, you will be required to master and use all sorts of tools for use in development and  one of such tools is “Git”.

Git is a free and open source distributed version control system designed to handle all types of projects from small to large ones with speed and efficiency. You will become more familiar with this piece of software later as we progress, do not worry too much about understanding at this point.

Github on the other hand is a service that allows you to upload your code using git and to manage your code using a nice web interface. Github and Git are not the same thing or even the same company, all you need to know at this point is that Git is a tool and Github is a service which can be manipulated using Git.

In this video, we are going to be going over the installation process of git on all usable operating systems and setting up a github account to be operated by git.

INSTALLING GIT 

In this section, we will go over the steps for installing git on windows, mac and linux operating systems respectively:

INSTALLING GIT AND LINKING SSH KEYS ON WINDOWS

  1. Go to the url download git and install, next we generate SSH keys.
  2. On your windows machine search and open the “windows powershell” and run the following command.
  3. Ssh-keygen -o -t rsa -c youremail@gmail.com
  4. You will have to select a folder where the public key can be stored.
  5. Next you will be prompted to put in a passphrase, choose an easy pass phrase to remember and continue.
  6. Now go to the folder you selected and copy your public key.
  7. The next step is to link the SSH key to github for windows users.
  8. Go to github and create an account, it is very simple to do and will be discussed just below.
  9. In your github click the top right part of the page and go to settings.
  10. Select SSH and GPG keys on the left and paste it in the box and click create.
  11. You will be required to provide your password to github to verify it's you and it is created.
  12. For more guidance reference the following video resource 
  13. You are done with this step.

LINUX

  1. On your linux machine you will need an internet connection and to run the following commands
  2. “sudo apt update” and  “sudo apt upgrade” will update your operating system.
  3. To install git type in “sudo apt install git” and run.
  4. Make sure the version is above 2.28 by running the command
git --version
  1. If it is below 2.28 then check out the resource for guidelines to reinstall
  2. You have successfully installed git.
  3. We will discuss linking the SSH key to github later for linux machines.

MAC OS

  1. First install homebrew
  2. Next check if you meet the requirements here
  3. Next paste the following in your terminal
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
  1. Now update git by typing the following in your terminal 
brew install git
  1. To check your version run
git --version
  1. Make it is at least version 2.28 or follow the steps again till it works
  2. Check out this resource for more guidance on this topic
  3. It is installed.
  4. We will discuss linking the SSH key to github later for mac os machines.

CREATE A GITHUB ACCOUNT

Installing git was straightforward because you did not need to create an account but github requires you to create an account to enable you to use their services.

  1. Got to the Github and create an account
  2. You will be required to provide an email address and password to remember, these need to be real and usable
  3. If you are concerned with privacy make sure to tick the options to keep your email private and continue.
  4. Creating an account on github is very easy and will not take you much time.

SETTING UP GIT

For git to work properly, we need to let it know who we are so that it can link a local Git user(you) to Github. When working on a team, this allows people to see what you have committed and who committed each line of code. All the lines of code will be typed in the Git you downloaded and installed, all you have to do is search for it and run it on your local machine.

The commands below will configure Git, be sure to enter your own information inside the quotes (but include your quotation marks)!

git config - -global user.name “Your github name”
git config - -globaluser.email “youremail@gmail.com”
  1. If you opted to use private github email address the second command will look like this
git config --global user.email "123456789+odin@users.noreply.github.com" 
  1. Next type the following commando change the default git branch 
git config --global init.defaultBranch main
  1. Now that you have provided your email and name we have to verify if they are correct.
  2. Run the following commands to check if the username and email were correctly inputed.
git config --get user.name” to check for name and “git config --get user.email
  1. If all the information is correct, then we are one step closer.
  2. For Macos users run the following commands to tell git to ignore the .DS_store files.
  3. First command.
echo .DS_Store >> ~/.gitignore_global
git config --global core.excludesfile ~/.gitignore_global

CREATE AN SSH KEY

An SSH key is like a cryptographically secure identifier, in other words it is like a really long password to verify your machine online. We have covered this for windows users, now let us look at this for mac and linux users in this section.

  1. Type the below code in the terminal
ls ~/.ssh/id_ed25519.pub
  1. If it shows the error message “No file such file or directory” then follow the next step.
  2. Type this code to get the algorithm 
ssh-keygen -t ed25519 -C
  1. When it prompts you for a location to save the generated key press enter.
  2. Enter a password when it asks you for one and continue.
  3. The next step is to link your SSH key to github, it has been covered earlier with windows but let us look at it again.

LINKING THE SSH KEY TO GITHUB

Now you will need to tell Github your SSH key so that you can push github code without typing your password every time.

  1. First of all go to Github and sign in
  2. In your github click the top right profile part of the page and go to settings.
  3. Select SSH and GPG keys on the left and paste it in the box and click create.
  4. You will be required to provide your password to github to verify it's you and it is created.
  5. You have successfully added your SSH key.
  6. To test your SSH key check out the following resource to do this 
  7. You are done with all installations and setups.

You have completed the basic installations section, as you progress through other exercises and learn new concepts there will be other tools to install, so keep an eye out for them.

This task may have been a bit too technical for someone who is very new to coding and you may not have understood all you were doing. That is 100% normal, just follow instructions and practise and you will get accustomed to everything with time.









What's Your Reaction?

like

dislike

love

funny

angry

sad

wow