Upload the local project to the Gitee warehouse hand in hand

1. Gitee creates a new warehouse

Create your own Gitee account and create a new warehouse, as shown in the figure:

insert image description here
According to your own project situation, fill in the warehouse information, as shown in the figure:

insert image description here
The warehouse is created, as shown in the figure:

insert image description here

2. Download Git

Available link for download address: https://registry.npmmirror.com/binary.html?path=git-for-windows/
Link source This blog
Open the link, as shown in the figure, select the latest version to enter:

insert image description here
Select Git-2.41.0.3-64-bit.exe to download:

insert image description here

3. Git installation

Double-click the downloaded Git-2.41.0.3-64-bit.exe to start the installation, click Next, as shown in the figure:

insert image description here
Select the installation directory and click Next, as shown in the figure:

insert image description here
Check according to personal needs, and then Next, as shown in the figure:

insert image description here
The following figure can directly click Next:

insert image description here
Choose Git default editor, the default is Vim, you can directly Next:

insert image description here
As shown in the figure below, just select the first one, let Git choose by itself, the name is master:

insert image description here
Adjust the path environment variable, select as shown, and click Next:

insert image description here
Select the SSH execution file, as shown in the figure:

insert image description here
Select the HTTPS backend transmission, as shown in the figure:

insert image description here
Configure the end-of-line symbol conversion, as shown in the figure, and then click Next:

insert image description here
Configure the terminal emulator to work with Git Bash, as shown in the figure:

insert image description here

Choose the default git pull behavior, as shown:

insert image description here
Choose a credential helper, the default is fine, click Next:

insert image description here
Configure additional options, after checking, click Next:

insert image description here
Configure experimental options, no need to choose, as shown in the figure:

insert image description here
Then start the installation:

insert image description here
The installation is complete:

insert image description here

4. Upload the local project to the Gitee warehouse

Enter the directory of the local project file that needs to be uploaded, right-click on the blank space, click Git Bash Here, and upload a file here, as shown in the figure:

insert image description here
Set the user name, the user name here needs to be the same as the Gitee user name, the setting command is

git config --global user.name 用户名

as the picture shows:

insert image description here
To check whether the configuration is successful, the command is as follows

git config user.name

As shown in the figure, the configuration is successful:

insert image description here
Set the user name, the mailbox here needs to be the same as the mailbox bound to Gitee, the setting command is

git config --global user.email 邮箱

as the picture shows:

insert image description here
Set the SSH public key to avoid the need to enter a password for each upload. This failed in the end. Possible reasons: company network restrictions, generate public key command

$ ssh-keygen -t rsa -C 邮箱

As shown in the figure, the generation is successful:

insert image description here
To view the complete public key content, command

 cat ~/.ssh/id_rsa.pub

as the picture shows:

insert image description here
Fill in the public key content to the Gitee setting page, as shown in the figure:

insert image description here
Add complete:

insert image description here
To test whether the public key is configured successfully, the command

 ssh -T [email protected]

The error shown in the figure should be caused by the network:

insert image description here
Use init to initialize the local project git warehouse, command

git init

as the picture shows:

insert image description here
To add project content from the working directory to the staging area, the command

git add .

as the picture shows:

insert image description here
Use the following command to add comments to submit

 git commit -m 提交的说明

as the picture shows:

insert image description here
Copy the http link in the remote warehouse, as shown in the figure:

insert image description here
Connect the local warehouse with the remote warehouse, enter the command

git remote add origin https://xxxxxxx

as the picture shows:

insert image description here
Since the public key configuration fails, you need to enter the Gitee username and password:

insert image description here
To push the files in the local warehouse to the specified remote warehouse, the command

git push -u origin master

The error is shown in the figure:

insert image description here
To merge conflicts between remote code and local code, the command

git pull --rebase origin master

as the picture shows:

insert image description here
Push the files in the local warehouse to the specified remote warehouse again, command

git push origin master

as the picture shows:

insert image description here
Finally, go back to the Gitee web page, refresh it, and the local project is successfully uploaded:

insert image description here

I hope this article is helpful to everyone. If there is anything wrong with the above, please correct me.

Sharing determines the height, and learning widens the gap

Guess you like

Origin blog.csdn.net/qq_42078934/article/details/131995627