push的不同默认远程

push的不同默认远程

本文介绍了git pull和git push的不同默认远程(跟踪分支)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法建立一个git仓库,这样中分支部分的远程变量的值来设置 code>,但是如何为每个方向单独做?

解决方案

对于Git 1.6.4和更高版本,设置 remote。< name> .pushurl 与 git config

这可以使用只读的 https:协议并使用基于ssh的协议进行推送。



$ b $ < origin 的网址( remote.origin.url )为 https://git.example.com/some/repo.git 。它是只读的,但您可以通过基于ssh的'URL' [email protected]:some / repo.git 来写入权限。运行以下命令以推送基于ssh的协议:

  git config remote.origin.pushurl [email protected] .com:some / repo.git 


Is there a way to set up a git repository, so that git pull defaults to one remote and git push defaults to another? I know I can set both by changing the value of the remote variable in branch section of .git/config, but how to do it for each direction separately?

解决方案

For Git 1.6.4 and later, set remote.<name>.pushurl with git config.

One might use this to pull using the read-only https: protocol and push using an ssh-based protocol.


Say origin's url (remote.origin.url) is https://git.example.com/some/repo.git. It is read-only, but you have write access through the ssh-based ‘URL’ [email protected]:some/repo.git. Run the following command to effect pushing over the ssh-based protocol:

git config remote.origin.pushurl [email protected]:some/repo.git

这篇关于git pull和git push的不同默认远程(跟踪分支)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-03 19:53