Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/git/21.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/heroku/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
git应该指向heroku还是我的别名_Git_Heroku - Fatal编程技术网

git应该指向heroku还是我的别名

git应该指向heroku还是我的别名,git,heroku,Git,Heroku,我在我的.git/config中有这个(获取指向开发人员的点) 我的同事有这个(把点拿到heroku) 它们似乎都起作用了。怎么可能呢?his的获取范围对于开发、暂存和生产是相同的。我们每个人实际从哪里获取信息?那里有3条信息 这是远程别名 [ remote "dev"] 在存在该配置项的存储库中,可以使用命令git remote、git fetch和git push。本地存储库可以使用它想要引用任何存储库的任何别名。别名的全部意义在于避免您每次键入较长的URL URL是用于查找特定别名存储库

我在我的
.git/config
中有这个(获取指向开发人员的点)

我的同事有这个(把点拿到heroku)


它们似乎都起作用了。怎么可能呢?his的获取范围对于开发、暂存和生产是相同的。我们每个人实际从哪里获取信息?

那里有3条信息

这是远程别名

[ remote "dev"]
在存在该配置项的存储库中,可以使用命令
git remote
git fetch
git push
。本地存储库可以使用它想要引用任何存储库的任何别名。别名的全部意义在于避免您每次键入较长的URL

URL是用于查找特定别名存储库的位置和通信协议

url = git@heroku.com:site-dev.git
因此,在您的示例中,
git-push-dev
将转换为
git-pushgit@heroku.com:site-dev.git

最后是fetch规范

fetch = +refs/heads/*:refs/remotes/dev/*

冒号前面的部分表示“我从远程获取的引用是什么”,冒号后面的部分表示“我将如何在本地引用这些引用”。通常情况下,您会让本地引用与远程别名匹配(正如您所做的,但您的同事没有),因为这样更容易考虑,但不需要这样做

谢谢安德鲁。看来我可以保持原样了,对吧?在三种不同的情况下(开发、登台和生产),同事将heroku视为“我将如何在本地引用这些引用”,您对此有何看法。这不会引起问题吗?你是说他在一个repostory/.git/config中有3个遥控器,还是说他有3个存储库,每个存储库都有一个别名不同的遥控器?我们有一个存储库。因此,我相信在一个存储库/git/config中会有3个远程服务器。我的配置中有以下内容:[branch“master”]remote=origin merge=refs/heads/master[branch“develope”]remote=origin merge=refs/heads/develope[remote“staging”]url=git@heroku.com:site-staging.git fetch=+refs/heads/*:refs/remotes/staging/*[remote“dev”]url=git@heroku.com:site-dev.git fetch=+refs/heads/*:refs/remotes/dev/*[remote“prod”]url=git@heroku.com:site-prod.git fetch=+refs/heads/*:refs/remotes/prod/*如果您说他有3个单独的遥控器指向3个不同的git存储库,但“fetch”行对他们来说是相同的,那么您的同事将遇到问题。
url = git@heroku.com:site-dev.git
fetch = +refs/heads/*:refs/remotes/dev/*