DEV Community

Cover image for How to Installing Git and Create your first Github Account in (Linux)
Salma
Salma

Posted on

How to Installing Git and Create your first Github Account in (Linux)

Before we start the procedure of Git configuration and creation of your first Github account, let me give you a quick explanation about Git and Github.

What is Github?

Github is one of the leading hosting platform/websites that help and allow you(Developers) to

1- Host/Store.
2- Manage.
3- Track.
4- Collaborate with other developers.
5- Control any changes you do to your codes by using another great tool called Git.

So, What is Git?

Git is an open-source distributed Version Control System (VCS) that designed to help you store, manage, track, control...etc your codes in Github whether small or large fastly and efficiently.

By the way, There are two ways to use Git:

1- First Way Called GUI Git Applications GUI Git is a type of application allow you to use the Git interface.

2- The second way is called the Command Line tool (CLI), Which gives you the ability to run Git commands from your terminal. (And this is what I will follow to install Git in your terminal).

Installing Git in (Linux)

Linux Installation Steps

Step 1

First, update your Linux system by typing the following command in your terminal

Alt Text

Step 2

Run the below command in your terminal to install Git

Alt Text

Step 3

Now we need to make Git work properly by configuring Git and Github, And we can do that by setting our personal information with Git to enable you to link your local Git user (You) to Github. The Benefit of this step is that when you work in a project with a team, everyone can see what you committed (You can consider that as your personal signature).

Enter this command to set your information with Git and please don't forget to type your name between the double quotation marks (Don't delete the quotation marks though)

Alt Text

Step 4

Great, we installed Git already. What you should do now before you link it to Github is, check Git work properly by running the below commands

Alt Text

Step 5

Create your personal account with GitHub

Please visit the Github.com website and sign-up your Username, Email, Password. (you don't need to type the same username and e-mail you used before with git, but it's a good idea if you use the same one)

Alt Text

Step 6

Create your SSH Key

What is the SSH key? When working with a GitHub repository, you'll often need to identify yourself to GitHub using your username and password. An SSH key is an alternate way to identify yourself that doesn't require you to enter your username and password every time.
SSH keys come in pairs, a public key that gets shared with services like GitHub, and a private key that is stored only on your computer. If the keys match, you're granted access.

Source of ٍStep 6 explanation: Software Carpentry
Website.

Let's first check if we have an SSH key already installed or not. Type this into your terminal

Alt Text

If you got a message in your output: No such file or directory, that means you don’t have an SSH key and you need to create a one, but if you got a message that you already have a key, then you are good to go to Step 7.

  • Now let's create your SSH key. Run the below command and don't forget to replace what inside the brackets and write your Email without including the brackets (<>) so the command will look like this (ssh-keygen -C salma@devcompany.com).

Alt Text

  • When it prompts you for a location to save the generated key, just push Enter.

  • Next, it will ask you for a password; enter one if you wish, but it’s not required.

Step 7

Link Your SSH Key with GitHub
  • It's time we tell Github what is your SSH key so that you can push your code without typing your password every time.

  • Now go and login Github, go to your profile image 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. Name your key with something descriptive and easy to remember. Leave this window open while you do the next steps.

You need to copy your public SSH key. To do this, we’re going to use a command called cat to read the file to the console.

Note

The .pub file extension is important in this case so please run the command below without adding or missing anything

Alt Text

  • Copy the output, which starts with ssh-rsa and ends with your email address.

  • Do you remember the window that we left it open in Github page, go back to it please and paste the key you copied into the key field.

Then, click Add SSH key. You’re done! You’ve successfully added your SSH key!

Step 8

Test Your SSH connection

After you've set up your SSH key and added it to your GitHub account, you can test your connection by following the instruction at Testing your SSH Github webpage.

If the output doesn’t correctly match up, then try going through these steps above again.

Top comments (0)