gitflow-avh icon indicating copy to clipboard operation
gitflow-avh copied to clipboard

"Not a gitflow-enabled repo yet. Please run 'git flow init' first." error message on newly git flow init'ed repo.

Open silasfn opened this issue 6 years ago • 10 comments

  • [x] I was not able to find an open or closed issue matching what I'm seeing

Setup

  • Which version of Git for Windows are you using? Is it 32-bit or 64-bit? 64 bit
$ git --version --build-options
git version 2.17.1.windows.2
cpu: x86_64
built from commit: a60968cf435951d9411fc0f980a2e362d5cccea2
sizeof-long: 4
  • Which version of Windows are you running? Vista, 7, 8, 10? Is it 32-bit or 64-bit?
$ cmd.exe /c ver

Microsoft Windows [Version 10.0.17134.1] - 64 bit
  • What options did you set as part of the installation? Or did you choose the defaults?
$  cat /etc/install-options.txt
Editor Option: Notepad++
Path Option: BashOnly
SSH Option: OpenSSH
CURL Option: OpenSSL
CRLF Option: LFOnly
Bash Terminal Option: MinTTY
Performance Tweaks FSCache: Enabled
Use Credential Manager: Enabled
Enable Symlinks: Enabled
  • Any other interesting things about your environment that might be related to the issue you're seeing?

No

Details

  • Which terminal/shell are you running Git from? e.g Bash/CMD/PowerShell/other

Bash, on MINGW64

## (on newly installed Git for Windows)
cd ~
# git clone any repo - eg:
git clone --recursive git://github.com/petervanderdoes/gitflow.git
cd gitflow
git checkout master
git checkout develop
git flow init

Which branch should be used for bringing forth production releases?
   - develop
   - master
Branch name for production releases: [master]

Which branch should be used for integration of the "next release"?
   - develop
Branch name for "next release" development: [develop]

How to name your supporting branch prefixes?
Feature branches? [feature/]
Bugfix branches? [bugfix/]
Release branches? [release/]
Hotfix branches? [hotfix/]
Support branches? [support/]
Version tag prefix? []
Hooks and filters directory? [(path/to)/gitflow/.git/hooks]

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


  • What did you expect to occur after running these commands? After running git flow init, I expected git flow feature start to create a feature branch

  • What actually happened instead? I got this error message: Fatal: Not a gitflow-enabled repo yet. Please run 'git flow init' first.

  • If the problem was occurring with a specific repository, can you provide the URL to that repository to help us with testing?

Seems to occur on any git repository I have cloned, including git clone --recursive git://github.com/petervanderdoes/gitflow.git

silasfn avatar Jun 12 '18 04:06 silasfn

I'm also getting that error on Windows using both Git Bash, Cmder or Powershell.

$ git flow version
1.11.0 (AVH Edition)

It's happening for both cloned and newly creates repos.

Is there any command line option to activate a verbose mode which would provide more info?

nmcc avatar Jun 15 '18 13:06 nmcc

Thanks to a tip from Johannes in the related git for windows project. I was able to debug using the set -x flag.

To debug git flow, see C:\Program Files\Git\usr\bin\git-flow

  • either set DEBUG="yes" in command line, or
  • add set -x at the beginning of the file.

To fix the "not gitflow-enabled repo" bug, 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)
}

My limited tests seem to work - git flow feature start test succeeded after that change, and returned an error after I removed the "gitflow.prefix" lines from my .git/config file (expected behaviour).

I'll create a pull request, but the change might end up in a new fork that Johannes is creating. See: https://github.com/git-for-windows/git/issues/1720#issuecomment-397799721

silasfn avatar Jun 17 '18 23:06 silasfn

Still get the error when finishing a release branch though. If you remove the fix release can be finished again.

harleyian avatar Jun 20 '18 14:06 harleyian

@silasfn What's the output of git config --get-regexp gitflow.prefix

petervanderdoes avatar Jun 24 '18 19:06 petervanderdoes

$ git config --get-regexp gitflow.prefix
gitflow.prefix.feature feature/
gitflow.prefix.bugfix bugfix/
gitflow.prefix.release release/
gitflow.prefix.hotfix hotfix/
gitflow.prefix.support support/
gitflow.prefix.versiontag

silasfn avatar Jun 24 '18 23:06 silasfn

... and I updated the PR based on a tip from Johannes.

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
}

Removing the $( ... ) from the last part of the statement seemed to resolve all issues. https://github.com/petervanderdoes/gitflow-avh/pull/374/files

silasfn avatar Jun 24 '18 23:06 silasfn

For future reference, I was also having this issue but it was a matter of updating my git version Previous version git version 2.18.X.windows.1 Did NOT work!

Updated version git version 2.19.1.windows.1 Works!

Meldow avatar Oct 11 '18 11:10 Meldow

I faced with the same problem:

$ git flow init -d
Using default branch names.
$ git flow feature start 123
Fatal: Not a gitflow-enabled repo yet. Please run 'git flow init' first.

Environment information:

$ uname -a
Linux or-dsktp-arch 4.20.8-arch1-1-ARCH #1 SMP PREEMPT Wed Feb 13 00:06:58 UTC 2019 x86_64 GNU/Linux

$ git flow version
1.12.0 (AVH Edition)

$ git --version
git version 2.20.1

$ git config --get-regexp gitflow.prefix
gitflow.prefix.feature feature/
gitflow.prefix.release 
gitflow.prefix.hotfix 
gitflow.prefix.support 
gitflow.prefix.versiontag 
gitflow.prefix.bugfix

I got the reason of error in my case. I am confused about status of current issue and I doubt that my case is related to it. So I made another issue: #402

Ovsyanka avatar Feb 21 '19 01:02 Ovsyanka

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

Please follow below steps to remove this issue:

  1. Open the .git\config file ( /!\ Show hiden items in your windows file explorer)

  2. Remove all the [gitflow * entries and save the file

  3. Close and (re-open SourceTree)

  4. Go in the main menu, go to Repository > Git Flow > Initialise Repository (should be enabled now)

  5. Or in the CLI type

git flow init

Hope this helps you !!!

Isayamp avatar Feb 23 '21 09:02 Isayamp

I just ran into this and it seemed to be because the production branch was not a local branch.

Example fix:

$ git config --get-regexp gitflow.branch.master
gitflow.branch.master production
$ git flow bugfix start 3000
Fatal: Not a gitflow-enabled repo yet. Please run 'git flow init' first.
$ git checkout production
branch 'production' set up to track 'origin/production'.
Switched to a new branch 'production'
$ git flow bugfix start 3000
Switched to a new branch 'bugfix/hexmode/3000'

Summary of actions:
- A new branch 'bugfix/hexmode/3000' was created, based on 'master'
- You are now on branch 'bugfix/hexmode/3000'

Now, start committing on your bugfix. When done, use:

     git flow bugfix finish 3000

hexmode avatar Apr 13 '23 17:04 hexmode