Home > Development Tools > git > Detailed explanation of how to install Github in Ubuntu system

Detailed explanation of how to install Github in Ubuntu system

PHPz
Release: 2023-03-31 14:27:53
Original
2192 people have browsed it

In our daily life, computers have become an indispensable tool for us, and the operating system is an indispensable support for computers. As a free operating system, Ubuntu provides users with a very stable and reliable operating environment. Github is one of the world's largest open source communities, where tens of thousands of programmers and developers share their projects and code. For programmers, it is very necessary to master the basic skills of using Ubuntu and Github. This article will introduce how to install Github in Ubuntu system.

1. Install Git

Github requires the support of Git, so first we need to install Git in the Ubuntu system. Open the Ubuntu system through the terminal and enter the following command:

sudo apt-get update
Copy after login

The function of this command is to update the system software package.

Next, we need to install Git and enter the following command:

sudo apt-get install git
Copy after login

The system will automatically check and download the Git package. During the installation process, the system will prompt the user to confirm whether to continue. After confirmation, the installation can begin. If the installation is successful, you will see the following information:

......
Setting up git (version) ...
......
Copy after login

2. Configure Github

After installing Git, we need to configure Github. By opening the terminal, enter the following command:

git config --global user.name "Your Name"
git config --global user.email "email@example.com"
Copy after login

Among them, "Your Name" and "email@example.com" need to be replaced with the user's real name and email address. Through these configurations, we can identify who we are and associate it with our Github account when submitting code on Github.

3. Generate SSH Key

Github uses SSH keys for authentication to ensure security. Therefore, we need to generate an SSH Key in the Ubuntu system and add it to the Github account. By opening the terminal, enter the following command:

ssh-keygen -t rsa -C "email@example.com"
Copy after login

Among them, "email@example.com" needs to be replaced with the user's real email address. When executing this command, the system will prompt the user to enter the name and password of the key. If a password is not required, just press Enter. After successful execution, you will see the following information:

Generating public/private rsa key pair.
Enter file in which to save the key (/home/you/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/you/.ssh/id_rsa.
Your public key has been saved in /home/you/.ssh/id_rsa.pub.
Copy after login

You can view the contents of the SSH Key by entering the following command:

cat ~/.ssh/id_rsa.pub
Copy after login

4. Add SSH Key

Open Github Home page, click on your avatar and select the "Settings" tab. Select the "SSH and GPG keys" option on the page, click the "New SSH key" button, enter the title and SSH Key, and click "Add SSH key".

5. Verify Github

After completing the previous steps, we can check whether the connection is successful through Github. Open the terminal and enter the following command:

ssh -T git@github.com
Copy after login

If the connection is successful, you will see the following message:

Hi username! You've successfully authenticated, but Github does not provide shell access.
Copy after login

At this point, we have successfully installed Github in the Ubuntu system. In the future development process, we can upload the code to Github for others to view and call.

The above is the detailed content of Detailed explanation of how to install Github in Ubuntu system. For more information, please follow other related articles on the PHP Chinese website!

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template