致命:还不是一个支持 gitflow 的仓库。请先运行'git flow init'

Fatal: Not a gitflow-enabled repo yet. Please run 'git flow init' first

我克隆了一个项目并且 运行 git checkout -b develop。当我 运行 git flow feature start feature_name 它给了我以下错误:

Fatal: Not a gitflow-enabled repo yet. Please run 'git flow init' first.

谁能帮帮我?

您必须在本地存储库上初始化 git 流。

GitFlow 是您计算机上的本地脚本,每个存储库都必须具有元数据(在配置中)才能使用它。

只是 运行 :

# launch the git flow wizard
git flow init


# Use git flow with default values
git flow init -d

你准备好了。

如果有人 运行 git flow init 并且它不起作用,则会出现如下错误: git: 'flow' is not a git command. See 'git --help'.


请遵循以下命令:

wget http://github.com/nvie/gitflow/raw/develop/contrib/gitflow-installer.sh –no-check-certificate

chmod +x gitflow-installer.sh

./gitflow-installer.sh

git flow init

我按照 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:

  1. Open the .git\config file OR Repository -> Repository Settings -> Remotes -> Edit Config File (Sourcetree 2.7.6)
  2. Remove all the [gitflow * entries and save the file
  3. Close and re-open SourceTree
  4. In the main menu, go to Repository > Git Flow > Initialise Repository (should be enabled now)

我通过在 SourceTree 上执行以下步骤使其工作:

设置 -> 高级 -> 编辑配置文件 -> 删除所有 gitflow * 条目并保存文件

现在您可以设置初始化存储库了。

我有不同的情况。

背景

如果您从未 git 流程初始化过您正在使用的特定存储库,或者您做过,并且想重新应用该操作以通过首先清除.git/config 文件中的相关条目。

我也用 SourceTree,发现它有这个问题。

我发现我最近做的不同的事情被清除了我的本地 master 分支,git 流一定被模棱两可地认为是一个 git 流未初始化的存储库,即使通过我我通常的配置已经存在了。

解决方案

我重新检查了我的 master 分支,git 流程再次运行(例如,开始一项新功能)!

我安装的 windows git 版本 Git-2.17.1.2-64-bit.

这是 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

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)}

希望他们尽快解决这个问题。

更新2018/07/23

即使进行了上述修复,这也只是返回。查看 PR to fix this,实际上应该删除包裹在违规行周围的 $():

git config --get-regexp gitflow.prefix >/dev/null 2>&1

您可以删除 <project_path>/.git/config 中的 gitflow.prefix,然后再次删除 git flow init

运行 'git flow init' 它会自动将所有分支初始化为相应的发布分支,如生产版本、下一个版本、修补程序分支等。这是一个快照:

如果你想重新初始化这些你可以写: 'git flow init -f' 这将强制重新初始化。

如果您在 MacOS 上使用 SourceTree 4.0 版(2019 年 9 月是此 post 时的最后一个版本),即使在 运行 之后,您仍可能 运行 出现相同的错误=]宁git flow init命令。
如果您重命名任何分支(例如,devel 而不是 develop),就会发生这种情况。似乎 git 流程中会出错,并且无法识别重命名的分支(您可能还会注意到提到默认分支名称的错误,而不是您在初始化期间指定的重命名名称)。

这种情况的解决方法是:

  • 从存储库配置文件中删除任何 git 流配置(查看此 post 如何执行此操作:
  • 退出Sourcetree(通过CMD+Q或在菜单栏中退出),然后重新启动Sourcetree
  • 使用默认值初始化git流。您可以通过 Sourcetree 的 git 流程按钮执行此操作,也可以使用 git flow init -dgit flow init 通过终端手动执行此操作,然后接受所有默认建议值
  • 从 Sourcetree 的分支列表中将本地分支重命名为您满意的名称
  • 再次打开存储库配置并重命名git流程配置中提到的分支以匹配您拥有的重命名分支,并保存配置
  • 退出Sourcetree(通过CMD+Q或在菜单栏中退出)

当您再次启动 Sourcetree 时,您现在应该可以正常使用 git 流。

如果有人运行 git flow init 但它不起作用导致出现这样的错误,则说明 git flow 根本没有安装在您的系统上。

git: 'flow' is not a git command. See 'git --help'.

查看 GitFlow Wiki 了解如何安装 git 流程。下面列出了 Mac 和 Linux 最常见的方式


Mac

brew install git-flow

Linux

apt-get install git-flow

fatal: Not a gitflow-enabled repo yet. Please run "git flow init" first.

请按照以下步骤解决此问题:

  1. 打开 .git\config 文件(/!\ 在 windows 文件资源管理器中显示隐藏项)

  2. 删除所有 [gitflow * 条目并保存文件

  3. 关闭并(重新打开 SourceTree)

  4. 进入主菜单,转到 Repository > Git Flow > Initialise Repository(现在应该启用)

    或在 CLI 中键入

    git 流初始化

希望对您有所帮助!!!