Git adds multiple URLs to the remote library. giturl_PHP tutorial

Source: Internet
Author: User
Git adds multiple URLs to the remote database, giturl. Git adds multiple url addresses to the remote library. the giturl Directory [-] uses the process principle for parsing. Note that Other can be found at: shede333 homepage: my. oschina. netshede333http: git adds multiple URLs to the remote library, giturl
Directory [-]
  • Prerequisites
  • Procedure
  • Principle analysis
  • Note:
  • Other
  • References

Author: shede333
Home: http://my.oschina.net/shede333 & http://blog.sina.com.cn/u/1509658847
Copyright Statement: original article, copyright statement: free reprint-Non Commercial-non derivative-keep the signature | [Creative Commons BY-NC-ND 3.0] []

Prerequisites

Generally, we add remote libraries for git, which are
git remote add origin (You can use real addresses instead \ )

However, you may want to push your local git library to github and open source China's Git @ OSC. how can this problem be solved.
Someone may use two or more remote libraries, that is, add another remote library.git remote add origin2;
This method is very inefficient, because you need git push twice to complete the push to two libraries.

In fact, there is another way: a remote git database can correspond to multiple addresses, that is, I can make the remote library origin have multiple url addresses. The method is as follows:

Procedure

First, we start from scratch. assume that you want to add three remote database addresses:

\ Https://git.oschina.net/shede333/swioslibary.git
\ Https://git.oschina.net/shede333/swscrollbar.git
\ Https://github.com/shede333/CoreAnimationTestSW.git

First, add the first address.git remote add origin
Then add the second address.git remote set-url --add origin
Add the third addressgit remote set-url --add origin
... And so on

In this way, you can add multiple addresses to the origin database.git push origin masterYou can push to the three databases at a time (usegit pushOR)

Principle analysis

git remote set-url --add originIs to the current git projectConfig fileAdd a record
Config fileThere are two open methods:

Every time you executegit remote set-url --add originA row is added, for example:

git remote -v: Displays the details of all the current remote databases in the formatRemote Database name url connection (type)

Therefore, you can directly add a url in the config file to modify the file. you do not have to execute the git command.

Note:

Usegit push origin masterYou can push to multiple origin URLs,
Howevergit pullOnly one url address (fetch-url, for example) in the origin can be pulled. the default fetch-url isThe first address you added to the origin,
If you want to change it, you only need to change the order of the three URLs in the config file. fetch-url will directly correspond to the top utl connection.

Other

I recently saw this article, which is similar in principle: hosting the project to Github and Git @ OSC at the same time
If you are interested, you can check it out.

References

IDEA/Git sets up multiple push remote repositories or submits multiple push repositories at the same time



From: http://my.oschina.net/shede333/blog/299032

Http://www.bkjia.com/PHPjc/1114476.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/1114476.htmlTechArticlegit to the remote library to add multiple url addresses, giturl Directory [-] The premise of the use of flow principle analysis note Other Reference Author: shede333 homepage: http://my.oschina.net/shede333http...

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.