在git中配置远程的方法 [英] Ways to configure remote in git
问题描述
在阅读此之后,我知道有3种方法可以提及遥控器的网址以及push和pull ref规范,以防被git push/pull跳过.
After reading this , I understood that there are 3 ways to mention url of a remote along with push and pull ref spec in case they are skipped for git push/pull.
Git配置文件中的远程:$ GIT_DIR/config,
a remote in the Git configuration file: $GIT_DIR/config,
$ GIT_DIR/remotes目录中的文件,或
a file in the $GIT_DIR/remotes directory, or
$ GIT_DIR/branches目录中的文件.
a file in the $GIT_DIR/branches directory.
如果发生冲突值,它们之间的优先级顺序是什么?
What is the priority order among them in case conflicting values occur ?
推荐答案
If you consider t/t5505-remote.sh#migrate a remote from named file in $GIT_DIR/branches (2)
, you will see that a file in .git/branches/
is actually transformed into a .gitconfig
remote refspec.
请参见 git remote rename
:
将名为
<old>
的遥控器重命名为<new>
.
所有的远程跟踪分支和远程配置都已更新.
rename the remote named
<old>
to<new>
.
All remote-tracking branches and configuration settings for the remote are updated.
如果<old>
和<new>
相同,并且<old>
是$GIT_DIR/remotes
或$GIT_DIR/branches
下的文件,则遥控器将转换为配置文件格式.
In case <old>
and <new>
are the same, and <old>
is a file under $GIT_DIR/remotes
or $GIT_DIR/branches
, the remote is converted to the configuration file format.
所以.gitconfig
显然是第一位.
在测试中,$GIT_DIR/remotes
位居第二,$GIT_DIR/branches
位居第三.
So .gitconfig
is clearly first.
From the tests, $GIT_DIR/remotes
is second, $GIT_DIR/branches
is third.
这篇关于在git中配置远程的方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!