Git Gitee of SpringCloud SpringBoot b2b2c micro service multi merchants settled in the live broadcast mall

Git Gitee

Recommended e-commerce source code

As we all know, the domestic visit to Github is slow, which affects our use.

If you want to experience the speed of Git flying, you can use the domestic Git hosting service—— Gitee(gitee.com).

Gitee provides a free Git warehouse and integrates functions such as code quality detection and project demonstration. For team collaborative development, gitee also provides project management, code hosting and document management services. Small teams with less than 5 people are free.

Next, let's learn how to use Gitee.

Since the transmission between our local Git warehouse and Gitee warehouse is encrypted through SSH, we need to configure authentication information.

1. Let's go first Gitee Register your account and log in, and then upload your SSH public key.

We have generated our own SSH public key in the Git Github chapter, so we only need to add ~ /. In the user's home directory ssh/id_ rsa. The contents of the pub file are pasted on Gitee.

Select the user Avatar - > settings in the upper right corner, then select "SSH public key", fill in a title that is easy to identify, and then put the password in the user's home directory ssh/id_ rsa. Paste the contents of the pub file:

After successful addition, it is shown in the following figure:

Next, we create a project.

Click the + sign in the upper right corner to create a new warehouse:

Then add warehouse information:

After successful creation, you will see the following information:

Next, let's look at the connection information:

The project name should preferably be consistent with the local library.

Then, we use the command "git remote add" on the local library to associate it with Gitee's remote library:

git remote add origin git@gitee.com:imnoob/runoob-test.git

After that, you can push with git push and git pull normally!

If an error occurs when using the command git remote add:

git remote add origin git@gitee.com:imnoob/runoob-test.git
fatal: remote origin already exists.

This indicates that the local library has been associated with a remote library named origin. At this time, you can use {git remote -v} to view the remote library information:

git remote -v
origin    git@github.com:tianqixin/runoob.git (fetch)
origin    git@github.com:tianqixin/runoob.git (push)

You can see that the local library has been associated with the remote library of origin, and the remote library points to GitHub.

We can delete the existing GitHub remote library:

git remote rm origin

Then associate Gitee's remote library (note that the correct user name needs to be filled in the path):

git remote add origin git@gitee.com:imnoob/runoob-test.git

At this point, we will view the remote library information:

git remote -v
origin    git@gitee.com:imnoob/runoob-test.git (fetch)
origin    git@gitee.com:imnoob/runoob-test.git (push)

Now you can see that origin has been associated with Gitee's remote library.

The git push command can push the local library to Gitee.

Some small partners have to ask, can a local library be associated with both GitHub and Gitee?

The answer is yes, because git itself is a distributed version control system, which can be synchronized to another remote library. Of course, it can also be synchronized to two other remote libraries.

When using multiple remote libraries, we should note that the default name given to the remote library by git is origin. If there are multiple remote libraries, we need to use different names to identify different remote libraries.

Still taking the runoob test local library as an example, we first delete the associated remote library named origin:

git remote rm origin

Then, first associate GitHub's remote library:

git remote add github git@github.com:tianqixin/runoob-git-test.git

Note that the name of the remote library is github, not origin.

Then, associate Gitee's remote library:

git remote add gitee git@gitee.com:imnoob/runoob-test.git

Also note that the name of the remote library is gitee, not origin.

Now, we use git remote -v to view the remote library information, and we can see two remote libraries:

git remote -v
gitee    git@gitee.com:imnoob/runoob-test.git (fetch)
gitee    git@gitee.com:imnoob/runoob-test.git (push)
github    git@github.com:tianqixin/runoob.git (fetch)
github    git@github.com:tianqixin/runoob.git (push)

If you want to push to GitHub, use the command:

git push github master

If you want to push to Gitee, use the command:

git push gitee master

In this way, our local libraries can synchronize with multiple remote libraries at the same time:

Added by Inkybro on Sun, 23 Jan 2022 10:51:05 +0200