我正在关注this steps成功管理Heroku中的2个环境,以及如何在git中设置它。一切都运行正常,但现在我有一个问题,git显示我的遥控器的旧名称,并不能删除它。
在本教程之前,我只有两个遥控器heroku
和staging
。但如上所述,建议的约定名称为production
和heroku
,因此我通过staging
文件将远程.git/config
重命名为staging
。在此更改中,我必须遵循此说明:"Cannot update paths and switch to branch at the same time"因为重命名的> git branch -avv
* develop [origin/develop] Merge branch 'dummy-fix' into develop
dummy-fix changed full vs first_name
master [origin/master] Merge branch 'develop'
staging [staging/master] Merge branch 'develop' into staging
remotes/heroku/master Merge branch 'develop'
remotes/origin/develop Merge branch 'dummy-fix' into develop
remotes/origin/master Merge branch 'develop'
remotes/production/master Merge branch 'develop'
remotes/staging/master Merge branch 'develop' into staging
遥控器不会显示任何分支。取得成功。
推送/拉取和部署现在使用Heroku envs非常好,但Sourcetree和git控制台显示旧的远程名称,我无法摆脱它:
remotes/heroku/master
远程> git remote rm heroku
error: Could not remove config section 'remote.heroku'
不存在,但当我这样做时:
.git/config
这是我的[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
ignorecase = true
precomposeunicode = true
[remote "origin"]
url = https://my-user@the-repo-url-in-bitbucket.git
fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
remote = origin
merge = refs/heads/master
[branch "develop"]
remote = origin
merge = refs/heads/develop
[remote "staging"]
url = https://git.heroku.com/my-app-name-in-staging.git
fetch = +refs/heads/*:refs/remotes/staging/*
[remote "production"]
url = https://git.heroku.com/my-app-name-in-production.git
fetch = +refs/heads/*:refs/remotes/production/*
[heroku]
remote = staging
[push]
default = tracking
[branch "staging"]
remote = staging
merge = refs/heads/master
(显然不是真正的网址):
{{1}}