Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to host a project to both gitee and github

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/02 Report--

This article focuses on "how to host a project to gitee and github at the same time". Interested friends may wish to take a look. The method introduced in this paper is simple, fast and practical. Let's let the editor learn how to host a project to gitee and github at the same time.

Recently, I am maintaining an open source project and want to do version management on both github and gitee. There is a feature on gitee that can synchronize projects on github. This feature works well. I just need to push the project update to github every time, and then click Refresh on gitee to synchronize the latest code from github.

However, after taking a look at the instructions on gitee, if you synchronize projects from github, you will not be able to get priority recommendations from the website, nor can you select and evaluate the most valuable open source projects. Although this is no big deal, but hard to maintain to give the project, always hope to be well promoted to let more people know.

So I went online to see if it was possible to push a project to github and gitee at the same time instead of synchronizing from github to gitee through synchronous refresh.

The advantage of the Internet is that as long as you think of it, there will always be someone who thinks before you; as long as you can ask questions accurately, you can find the answer you want. Google results can be found in:

Of course, the result can be achieved, and the specific steps are as follows: here we take two git repositories, github and gitee, as examples:

Assuming you've uploaded the project to github, I won't go into details on how to upload it here; if you don't even know this, you can take a look at my other articles about entertainment gossip. First execute in the project console

Git remote-v

View the remote warehouse address of the current project as follows:

Origin https://enilu:mypassword@github.com/enilu/material-admin.git (fetch) origin https://enilu:mypassword@github.com/enilu/material-admin.git (push)

As explained here, because I have multiple github accounts and don't bother to configure ssh key, I directly change the .git / config file to manage multiple accounts in the way of user name: password @ github.com.

Then you need to add the project to the gitee repository at the same time.

Git remote add gitee https://gitee.com/enilu/material-admin.git

Push to remote warehouse:

Git push-u gitee

This pushes the project to the gitee warehouse as well

When the subsequent code is updated, submit Emma first, and then use the following two commands to submit to github and gitee, respectively

Git push-u origingit push-u gitee

As you can see, we need to push twice in the above way, so can we push it to githu and gitee at the same time? the answer is yes.

First delete the gitee remote warehouse address you just added

Git remote rm gitee

Then add with the following command:

Git remote set-url-- add origin https://gitee.com/enilu/material-admin.git

Finally, check the remote warehouse address information.

Git remote-vorigin https://enilu:mygithubpassword@github.com/enilu/material-admin.git (fetch) origin https://enilu:mygithubpassword@github.com/enilu/material-admin.git (push) origin https://enilu:mygiteepassowrd@gitee.com/enilu/material-admin.git (push)

Of course, if you can't remember the command, you can also change the .git / config configuration file directly to change the contents of the file as follows:

[remote "origin"] url = https://enilu:mygithubpassword@github.com/enilu/material-admin.git fetch = + refs/heads/*:refs/remotes/github/* url = https://enilu:mygiteepassowrd@gitee.com/enilu/material-admin.git

How is it? is it very simple? Recently, Golden hair has been fooling around. maybe one day your github account will be deleted, and it will be more safe to deposit one more copy on gitee.

At this point, I believe you have a deeper understanding of "how to host a project to gitee and github at the same time". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report