致命:还不是支持 gitflow 的存储库。请先运行“git flow init”
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/36843062/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Fatal: Not a gitflow-enabled repo yet. Please run 'git flow init' first
提问by Melek Yilmaz
I cloned a project and I ran git checkout -b develop
and then when I run git flow feature start feature_name
it gives me this error :
我克隆了一个项目并运行git checkout -b develop
,然后当我运行git flow feature start feature_name
它时出现此错误:
Fatal: Not a gitflow-enabled repo yet. Please run 'git flow init' first.
can any one help me ?
谁能帮我 ?
采纳答案by CodeWizard
You have to init the git flow on your local repo.
您必须在本地存储库上初始化 git 流程。
GitFlow are local scripts on your machine and each repository has to have teh metadata (in the config) to use it.
GitFlow 是您机器上的本地脚本,每个存储库都必须有元数据(在配置中)才能使用它。
simply run :
只需运行:
# launch the git flow wizard
git flow init
# Use git flow with default values
git flow init -d
And you are set to go.
你准备好了。
回答by Anima-t3d
I got it working by doing the steps mentioned by jpfl@ answers.atlassian.com:
我通过执行jpfl@ answers.atlassian.com提到的步骤让它工作:
Although this is an old post, just wanted to add to this since I've gotten stuck on this same error. Was able to resolve by doing the following:
- Open the .git\config file OR Repository -> Repository Settings -> Remotes -> Edit Config File (Sourcetree 2.7.6)
- Remove all the [gitflow * entries and save the file
- Close and re-open SourceTree
- In the main menu, go to Repository > Git Flow > Initialise Repository (should be enabled now)
虽然这是一篇旧帖子,但我只是想补充一下,因为我遇到了同样的错误。能够通过执行以下操作来解决:
- 打开 .git\config 文件或 Repository -> Repository Settings -> Remotes -> Edit Config File (Sourcetree 2.7.6)
- 删除所有 [gitflow * 条目并保存文件
- 关闭并重新打开 SourceTree
- 在主菜单中,转到 Repository > Git Flow > Initialise Repository(现在应该启用)
回答by Tai Le
If anybody run git flow init
and it doesn't work, an error like this:
git: 'flow' is not a git command. See 'git --help'.
如果有人运行git flow init
但它不起作用,则会出现如下错误:
git: 'flow' is not a git command. See 'git --help'.
Please follow these commands:
请遵循以下命令:
wget http://github.com/nvie/gitflow/raw/develop/contrib/gitflow-installer.sh –no-check-certificate
wget http://github.com/nvie/gitflow/raw/develop/contrib/gitflow-installer.sh –no-check-certificate
chmod +x gitflow-installer.sh
chmod +x gitflow-installer.sh
./gitflow-installer.sh
./gitflow-installer.sh
git flow init
git flow init
回答by Pysis
I had a different situation.
我有不同的情况。
Background
背景
The other answers are fine if you have never git flow initialized the specific repository you are working with, or you did, and want to re-apply that action to clear some buggy state by first clearing the relevant entries out of your .git/config
file.
如果您从未 git flow 初始化您正在使用的特定存储库,或者您已经初始化,并且想要通过首先清除.git/config
文件中的相关条目来重新应用该操作以清除某些错误状态,那么其他答案也很好。
I also use SourceTree, and noticed it was having this problem.
我也使用 SourceTree,并注意到它有这个问题。
I found what I had done differently recently was cleared out my local master
branch that git flow must have ambiguously considered to be a git flow uninitialized repository, even through I had my usual configuration already present.
我发现我最近所做的不同之处是清除了我的本地master
分支,即 git flow 必须模棱两可地认为是一个 git flow 未初始化的存储库,即使我已经有了我通常的配置。
Solution
解决方案
I re-checked out my master
branch, and git flow works again (to start a new feature, for example)!
我重新检查了我的master
分支,并且 git flow 再次工作(例如,启动一个新功能)!
回答by ita9178
I got it working by doing the steps on SourceTree:
我通过在 SourceTree 上执行以下步骤使其工作:
Settings -> Advanced -> Edit Config File -> Remove all the gitflow * entries and save the file
设置 -> 高级 -> 编辑配置文件 -> 删除所有 gitflow * 条目并保存文件
and now you can set Initialise Repository.
现在您可以设置 Initialise Repository。
回答by Tristan Channing
There is a bug causing this in the version of git for windows I have installed, Git-2.17.1.2-64-bit.
在我安装的 Windows 的 git 版本 Git-2.17.1.2-64 位中存在导致此问题的错误。
Here is a fix for this outlined in an issue raised at https://github.com/petervanderdoes/gitflow-avh/issues/372
这是在https://github.com/petervanderdoes/gitflow-avh/issues/372提出的问题中概述的解决方法
edit file C:\Program Files\Git\usr\bin\gitflow-common and add a ! just before $(git config --get-regexp gitflow.prefix >/dev/null 2>&1) ... ie change to this around line 297
编辑文件 C:\Program Files\Git\usr\bin\gitflow-common 并添加一个 ! 就在 $(git config --get-regexp gitflow.prefix >/dev/null 2>&1) 之前……即在第 297 行附近更改为
gitflow_is_initialized() {
gitflow_has_master_configured && \
gitflow_has_develop_configured && \
[ "$(git config --get gitflow.branch.master)" != "$(git config --get gitflow.branch.develop)" ] && \
! $(git config --get-regexp gitflow.prefix >/dev/null 2>&1)}
Hopefully they fix this soon.
希望他们尽快解决这个问题。
Update 2018/07/23
更新 2018/07/23
This just returned even with above fix. Looking at the PR to fix this, should actually remove the $() wrapped around the offending line:
即使使用上述修复,这也刚刚返回。查看PR 来解决这个问题,实际上应该删除包裹在违规行周围的 $() :
git config --get-regexp gitflow.prefix >/dev/null 2>&1
回答by gaozhidf
You can remove gitflow.prefix
in <project_path>/.git/config
, and git flow init
again
您可以删除gitflow.prefix
in <project_path>/.git/config
,然后git flow init
再次
回答by Deeksha Sharma
Run
'git flow init'
and it will automatically initialize all the branches to the respective release branches like production release, next release, hotfix branches etc will be set. Here is a snapshot for that :
运行“git flow init”,它会自动将所有分支初始化到相应的发布分支,如生产发布、下一个发布、修补程序分支等将被设置。这是一个快照:
If you want to reinitialize these you can write: 'git flow init -f' this will force reinitialization.
如果你想重新初始化这些你可以写:'git flow init -f' 这将强制重新初始化。
回答by cristian
If you're using SourceTree version 4.0 on MacOS (Sep 2019 is the last release at the time of this post) you may still run into the same error even after running the git flow init
command.
This can happen if you rename any branches (for example, devel instead of develop). It seems that something will error out in git flow, and will not recognise the renamed branches (you might also notice errors mentioning the default branches names instead of the renamed ones that you specified during initialization).
如果您在 MacOS 上使用 SourceTree 4.0 版(2019 年 9 月是本文发布时的最后一个版本),即使在运行该git flow init
命令后,您仍可能遇到相同的错误。
如果您重命名任何分支(例如,使用 devel 而不是 develop),就会发生这种情况。似乎有些东西会在 git flow 中出错,并且无法识别重命名的分支(您可能还会注意到错误提到了默认分支名称而不是您在初始化期间指定的重命名分支)。
The solution in this case is:
这种情况下的解决办法是:
- delete any git flow configuration from the repository config file (check out this post on how to do it: https://stackoverflow.com/questions/36843062#41542589)
- exit Sourcetree (through CMD+Q or quit in the menu bar), then start Sourcetree again
- initialize git flow with the default values. You can do that either from Sourcetree's git flow button, or manually through the terminal with
git flow init -d
orgit flow init
and then accepting all the default suggested values - from Sourcetree's branches list rename the local branches to what you're happy with
- open the repository configuration again and rename branches mentioned in git flow configuration to match the renamed branches that you have, and save the config
- exit Sourcetree (through CMD+Q or quit in the menu bar)
- 从存储库配置文件中删除任何 git flow 配置(查看这篇文章了解如何操作:https: //stackoverflow.com/questions/36843062#41542589)
- 退出Sourcetree(通过CMD+Q或在菜单栏中退出),然后再次启动Sourcetree
- 使用默认值初始化 git flow 。您可以通过 Sourcetree 的 git flow 按钮执行此操作,也可以通过终端手动使用
git flow init -d
或git flow init
然后接受所有默认建议值 - 从 Sourcetree 的分支列表中,将本地分支重命名为您满意的名称
- 再次打开存储库配置并重命名 git flow 配置中提到的分支以匹配您拥有的重命名分支,并保存配置
- 退出 Sourcetree(通过 CMD+Q 或在菜单栏中退出)
When you'll start Sourcetree again, you should now be able to use git flow normally.
当您再次启动 Sourcetree 时,您现在应该可以正常使用 git flow。