Home >Development Tools >git >How to build github (tutorial sharing)
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:
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.
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.
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
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.
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.
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 }
}
Save and exit.
Enter the following command in the terminal to restart the Nginx server:
sudo systemctl restart nginx
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!