Upload code to GitHub and code cloud at the same time

Time:2019-8-13

It used to store code in github, but it feels good after touching the code cloud. But suddenly found that the upload code was lost, want to upload the results to GitHub on the code cloud, do not know how to switch. After all, git skills are not enough. After online queries, organize them to avoid forgetting them.

Because git itself is a distributed version control system, it can be synchronized to another remote library, of course, it can also be synchronized to two other remote libraries, so a local library can be associated with both GitHub and code cloud!
When using multiple remote libraries, it should be noted that the default name git gives to the remote library is origin. If there are multiple remote libraries, we need to identify different remote libraries with different names. Still take the learngit local library as an example, first delete the associated remote library named origin:

git remote rm origin

Then, first associate GitHub’s remote library:

git remote add github [email protected]:xxx/LearnGit.git

Note that the name of the remote library is github, not origin.
Next, the remote library of the code cloud is associated:

git remote add gitee [email protected]:xxx/LearnGit.git

Also note that the name of the remote library is gitee, not origin.
Now, let’s usegit remote -vLooking at the remote library information, you can see two remote libraries:

gitee   [email protected]:xxx/LearnGit.git (fetch)
gitee   [email protected]:xxx/LearnGit.git (push)
github  [email protected]:xxx/LearnGit.git (fetch)
github  [email protected]:xxx/LearnGit.git (push)

If you want to push to GitHub, use the command:
git push github master
If you want to push to the code cloud, use the command:
git push gitee master
In this way, local libraries can synchronize with multiple remote libraries at the same time.

Original: https://blog.csdn.net/xukai01…

Recommended Today

Manjaro uses SS method (requires nodejs environment)

Just installed manjaro, need to installshadowsocks-qt5+Proxy SwitchyOmega, but the latest Chrome has long blocked the installation of non Google store CRX channels. Here is my solution, which is troublesome but usable. If you are familiar with NPM commands in nodejs, you won’t find it troublesome, because nodejs is used for compilation. Preparation environment: A VPS […]