Home > Development Tools > git > How to build github (tutorial sharing)

How to build github (tutorial sharing)

PHPz
Release: 2023-04-06 13:55:05
Original
1009 people have browsed it

With the rise of open source software and Github being acquired by Microsoft, more and more developers, especially students and beginners, are willing to build their own personal Github to back up their own code and open source projects and manage themselves. development history and achievements, and seek exchanges with like-minded technology enthusiasts. This article will provide a simple Github setup tutorial, as follows:

  1. Register a domain name

First you need to apply for a domain name. It is recommended to choose the most commonly used .Com domain name and register it The cost is about 100-200 yuan. When applying for a domain name, you need to fill in real information. It is recommended to use the names of your relatives and friends.

  1. Apply for cloud server

To build Github, you need your own cloud server. You can choose Tencent Cloud, Alibaba Cloud or AWS, etc. It is recommended to choose the cheapest basic configuration. That’s it.

  1. Install Git and Nginx

Enter the following commands in the terminal to install Git and Nginx:

sudo apt-get update

sudo apt-get install git

sudo apt-get install nginx

  1. Generate SSH Key

Enter the following command in the terminal and enter your own Github Email address:

ssh-keygen -t rsa -b 4096 -C "your_email@example.com"

After pressing Enter, you will be prompted to enter the file name and password. You can directly press Enter without filling in the fields. After generation, you will see two files in the .ssh folder in the user's home directory, id_rsa and id_rsa.pub.

  1. Copy SSH Key to Github

Enter the following command in the terminal to copy the SSH Key to the clipboard:

sudo apt-get install xclip

xclip -sel clip < ~/.ssh/id_rsa.pub

Log in to Github, enter personal settings, select SSH keys, enter Title and Key in the New SSH key column, and add just Paste the copied SSH Key into Key and click Add SSH key.

  1. Configure Nginx

Enter the following command in the terminal to open the Nginx configuration file:

sudo vim /etc/nginx/sites-available/default

Find server {} in the file, delete the entire content within {}, and copy the following code into it:

server {

listen 80 default_server;
listen [::]:80 default_server;
server_name example.com www.example.com;  #替换成自己的域名
root /var/www/html;  #根目录
index index.html index.htm index.nginx-debian.html;
location / {
    proxy_pass https://github.com;  #转发到github
}
Copy after login

}

Save and exit.

  1. Restart Nginx

Enter the following command in the terminal to restart the Nginx server:

sudo systemctl restart nginx

  1. Test Github build

Enter your domain name in the browser, for example: http://example.com. If you jump to the github page, it means that Github is successfully built.

Conclusion:

Through the Github building tutorial described in this article, you can easily build your own Github, manage your own code and open source projects on it, and record your own technical growth process. And communicate and share with like-minded technology enthusiasts. I hope it can be helpful to your study and work!

The above is the detailed content of How to build github (tutorial sharing). 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