Upload the project’s local code to GitHub

Github is a custody platform for open source and proprietary software projects. Since GIT only supports GIT as the only version of the hosting library format, it is called GitHub. This article mainly explains how to upload local code to GitHub.

Git Bash is an application suitable for the Microsoft Windows environment that provides a mock layer for the GIT command line experience. It is equivalent to a UNIX command line terminal, which is emulated by Git Bash on a window and then runs GIT bound versions in that terminal.
Git bash download URL: https://git-scm.com/downloads/

Download git bash

Since my system win download windows version.

Install git bash

In fact, the next step is the default one.

obligatory mailbox

Open git bash and link the mailbox first.

git config --global user.email "******@qq.com"

Generate an SSH key

Type SSH -KKEYGEN -T RSA -C “Mailbox Name” associated with the quoted internal mailbox and then there will be instant operations. It usually does, and you need to type Y.

ssh-keygen -t rsa -C "[email protected]"

The above instructions will generate .ssh files. You need to find the file and open id_rsa.pub in a notepad

Open the GitHub settings interface and click on setup.
 Press the SSH and GPG keys.

Click New SSH Keys.

Copy the content in id_rsa.pub into a key and enter your address.

Type ssh -t [email protected] in Git Bash to see if it worked.

ssh -T [email protected].com

Create a github library

Go to the GitHub homepage and create your own GitHub library. There are two ways to create a warehouse. The first is the green button on the left and right. What’s new in the repository, or the big “Run Project” button on the right side of the center bar.

Fill in the information

Branch or warehouse address.

After creating a new interface, the following interface will appear, and the address in the red box must be used in the next interface.

New file

The newly created Local Computers folder is empty. This folder is used to place the code that needs to be downloaded.
I created a git folder on the D drive.

New repository, new clone

Enter the newly created folders, right-click the mouse, select Git Bash here, then the command build window will pop up.

Sub repository

Here you need to clone or double repository address, input instructions: GIT clone + repository address

git clone https://github.com/845656974/project.git

After you finish writing, there will be an additional folder under the newly built folder. Then put the code into the generated folder.

The folder contains a hidden .git folder that is used to keep track of the version control library. Do not modify this file. Without this file, you can type git init command in Git Bash. I have put the project in this folder.


Enter the name of the CD + folder on the command line and switch to the directory.

cd project/

Enter git add. or git add + filename , git add. Download all files to a folder.

git add . 

The contents of the GIT Commit -M quoted “program” can be changed at will.

git commit -m "progect"

Enter GIT Push Origin Master, which should be directly in the interface.

Currently, you need to open the GitHub settings interface and click on setup.
 Open developer options.

Open Personal Access Tokens and click Create New Token.

After that, all fields are selected, press to confirm, then a character string will be displayed.

If successful, the following download information will appear.

Failing will allow the GitHub user to be logged in. Once you enter the account password, it will not be needed in the future.

Open GitHub, find the generated library and the following interface is fine.

The above code will be sent to Group Q. Group QQ: 615061293.
Pay attention to the WeChat public account “Notes”, keep updating articles and teaching materials, and you can add author communication and teaching!

Leave a Comment