Manage multiple remote code libraries with Git bash Technology
Maybe yes posted on 2015-01-15 13:11
Original link: http://blog.lmlphp.com/archives/62 from: lmlphp backyard
My other article, "GitHub git Bash tutorial," Recently, Baidu and other search engines have brought some traffic, see a lot of netizens browsing, there are many netizens have been to many times. This article adds some additional information about how to use GIT to push code to multiple remote code repositories. Usage scenarios: For example, our project was put into GITHUB and Gitosc at this time, there was only one project code locally, and when the local development was updated to maintain the consistency of the remote two remote repository, the code had to be pushed to two remote servers at the same time.
This will not use GitHub's own GIT client, which is customized for the GitHub for Windows client and is not convenient for pushing to other services.
In the GIT client, use the eval ' ssh-agent ' (Note that the database field symbol, which is the key to the left of the keyboard number 1) commands into SSH mode, open the Key Manager, and then use the Ssh-add command to add the private key. Many unfamiliar people are often unable to connect to the server by using SSH commands because they do not perform ssh-agent.
The
Domestic GIT hosting service Gitosc cannot use the SSH protocol to push code function, can only be used to pull the project updates, the official recommendation uses the HTTPS protocol to push the code, it is inconvenient, it is necessary to enter a user name and password each time. There are tutorials on the internet to enable the HTTPS protocol to remember the password method, but feel too much trouble, I am more accustomed to SSH to bring convenience. The first time I managed to host the lmlphp code in Gitosc, I didn't know how to use the HTTPS protocol push because I was accustomed to the GITHUB SSH operation. From the operations log below, you can see the contents of the. git/config file, either by modifying the profile to add a remote library, or by using the GIT remote Add Origin_xxx address method to add a remote library. In the following operation example, the remote library Origin_gitosc is pushed using the HTTPS protocol, and each push update requires a user name and password, and the remote repository origin is code-pushed using the SSH protocol, and you need to add the key file yourself. Key file in the creation of the time can be set password, with a password, each time the "ssh-add" command, the need to enter a password to be added, is also considered a security measure.
welcome to git (version 1.9.4-preview20140929) run ' Git help git ' to display the help index. run ' git help <command> ' to display help for specific Commands. [email protected] ~$ cd documents/[email protected] ~/documents$ cd github/lmlphp/[email protected] ~/documents/github/lmlphp (Develop) $ git statuson branch developYour branch is up-to-date with ' Origin/develop '. Nothing to commit, working directory clean[email protected] ~/documents/github/ lmlphp (Develop) $ git branch -av* develop e6e8db4 Modify default_theme_name constant name master e6e8db4 modify default_theme_name constant name remotes/ origin/head -> origin/master remotes/origin/develop e6e8db4 modify default_ theme_name constant name remotes/origin/master e6e8db4 modify default_theme_name constant name remotes/origin_ gitosc/develop e6e8db4 modify default_theme_name constant name remotes/ Origin_gitosc/master e6e8db4 modify default_theme_name constant name[email protected] ~/Documents/GitHub/LMLPHP (Develop) $ git pull origin developfrom github.com:leiminglin/lmlphp * branch develop -> fetch_headalready up-to-date. [email protected] ~/documents/github/lmlphp (Develop) $ lslicense readme.md lib lml.min.php lml.php lmlphp_logo_200.png[email protected] ~/Documents/GitHub/LMLPHP (Develop) $ cat .git/config[core] repositoryformatversion = 0 filemode = false bare = false logallrefupdates = true symlinks = false ignorecase = True hidedotfiles = dotgitonly[remote "origin"] url = [email protected] : leiminglin/lmlphp.git fetch = +refs/heads/*:refs/ remotes/origin/*[branch "Master"] remote = origin merge = refs/heads/master[branch "Develop "] remote = origin merge = refs/heads/develop[remote "Origin_gitosc"] url = https://git.oschina.net/leiminglin/LMLPHP.git fetch = +refs/heads/*:refs/remotes/origin_gitosc/*[email protected] ~/Documents/GitHub/LMLPHP (Develop) $ eval ' ssh-agent ' Agent pid 13436[email protected] ~/documents/github/lmlphp (Develop) $ ssh-add ./. /.. /.. /.ssh/github_rsaidentity added: ./. /.. /.. /.ssh/github_rsa (./.. /.. /.. /.SSH/GITHUB_RSA) [email protected] ~/documents/github/lmlphp (develop) $
PS: It seems that this blog urgently need a related article function, in addition to the background can be customized, the program automatically find better.
Read (63) reviews (0) View comments
Manage multiple remote code libraries with Git bash