1. Gitee creates a new warehouse
Create your own Gitee account and create a new warehouse, as shown in the figure:
According to your own project situation, fill in the warehouse information, as shown in the figure:
The warehouse is created, as shown in the figure:
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:
Select Git-2.41.0.3-64-bit.exe to download:
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:
Select the installation directory and click Next, as shown in the figure:
Check according to personal needs, and then Next, as shown in the figure:
The following figure can directly click Next:
Choose Git default editor, the default is Vim, you can directly Next:
As shown in the figure below, just select the first one, let Git choose by itself, the name is master:
Adjust the path environment variable, select as shown, and click Next:
Select the SSH execution file, as shown in the figure:
Select the HTTPS backend transmission, as shown in the figure:
Configure the end-of-line symbol conversion, as shown in the figure, and then click Next:
Configure the terminal emulator to work with Git Bash, as shown in the figure:
Choose the default git pull behavior, as shown:
Choose a credential helper, the default is fine, click Next:
Configure additional options, after checking, click Next:
Configure experimental options, no need to choose, as shown in the figure:
Then start the installation:
The installation is complete:
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:
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:
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:
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:
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:
To view the complete public key content, command
cat ~/.ssh/id_rsa.pub
as the picture shows:
Fill in the public key content to the Gitee setting page, as shown in the figure:
Add complete:
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:
Use init to initialize the local project git warehouse, command
git init
as the picture shows:
To add project content from the working directory to the staging area, the command
git add .
as the picture shows:
Use the following command to add comments to submit
git commit -m 提交的说明
as the picture shows:
Copy the http link in the remote warehouse, as shown in the figure:
Connect the local warehouse with the remote warehouse, enter the command
git remote add origin https://xxxxxxx
as the picture shows:
Since the public key configuration fails, you need to enter the Gitee username and password:
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:
To merge conflicts between remote code and local code, the command
git pull --rebase origin master
as the picture shows:
Push the files in the local warehouse to the specified remote warehouse again, command
git push origin master
as the picture shows:
Finally, go back to the Gitee web page, refresh it, and the local project is successfully uploaded:
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