30

I cloned a project and ran git checkout -b develop. When I run git flow feature start feature_name it gives me the following error:

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

can any one help me?

12 Answers 12

70

I got it working by doing the steps mentioned by 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)
Sign up to request clarification or add additional context in comments.

4 Comments

Unfortunately this didn't work for me. After editing the config i received this error: git init -d Using default branch names. Fatal: Local branch 'master' does not exist. Which branch should be used for bringing forth production releases? - productive - stable Branch name for production releases: [master] Completed with errors, see above so i found this jira.atlassian.com/browse/… and ended renaming the branchs as the suggested defaults of gitflow.
@Takatalvi did you have a master branch to begin with?
Yep. The only "weird" name was the develop branch, called development, in my case. During the initial config of the git flow i used development as develop branch but it didn't work and it's also a bug from sourcetree.
This just cause the same error again. Maybe it does not like the duplicate main branch.
28

You have to init the git flow on your local repo.

GitFlow are local scripts on your machine and each repository has to have teh metadata (in the config) to use it.

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.

2 Comments

I guess you mean "git flow init -d " instead of "git flow -d", right?
i have the same issue, and i have already done git flow init. Not first time creating a flow branch. This is another problem.
16

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.

I also use SourceTree, and noticed it was having this problem.

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.

Solution

I re-checked out my master branch, and git flow works again (to start a new feature, for example)!

2 Comments

+1 I accidentally deleted local master and started getting this issue. After checkout master the problem was solved
Yes, this is a good answer. There is a bug in git flow that if there's no master branch, it will claim that it's "not a gitflow-enabled repo yet". Will report this.
9

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'.


Please follow these commands:

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

5 Comments

This is helpful, but no in the context of current question, error mentioned in the question is not that git flow is not found.
@AbbeyJackson Try the solution in my answer I tried the others, but the one described in my answer seems to be the most straightforward solution.
@Anima-t3d Thanks for taking the time to reply, this question already has an accepted answer that worked...essentially I didn't know that gitflow was something I had to initialize.
@AbbeyJackson I think your machine missing wget, how to install it: stackoverflow.com/a/33902055/2957534
Thanks everyone for your follow up replies, the accepted answer from April 25, 2016 is what I needed to do.
5

I got it working by doing the steps on SourceTree:

Settings -> Advanced -> Edit Config File -> Remove all the gitflow * entries and save the file

and now you can set Initialise Repository.

2 Comments

This worked for me too. I don't think this is a sourcetree specific fix. Rather you can just go to .git/config to and remove all gitflow entries to get a fresh start.
I did your steps then I found that I couldn't initialise again because it couldn't find master, the thing is master was on remote so I just checked out master, I pasted my Config File (I saved a copy before doing changes of course) and then everything worked again, just in case someone have their local develop or production branch deleted you have to checkout again
3

If anybody runs git flow init and it doesn't work resulting in an error like this, git flow is simply not installed on your system.

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

Have a look at the GitFlow Wiki to find out how to install git flow. The most common way for Mac and Linux is listed below


Mac

brew install git-flow 

Linux

apt-get install git-flow 

Comments

2

There is a bug causing this in the version of git for windows I have installed, Git-2.17.1.2-64-bit.

Here is a fix for this outlined in an issue raised at 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)} 

Hopefully they fix this soon.

Update 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:

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

Comments

2

You can remove gitflow.prefix in <project_path>/.git/config, and git flow init again

Comments

0

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 : enter image description here

If you want to reinitialize these you can write: 'git flow init -f' this will force reinitialization.

Comments

0

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

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 or git 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)

When you'll start Sourcetree again, you should now be able to use git flow normally.

Comments

0

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)

    Or in the CLI type

    git flow init

Hope this helps you !!!

Comments

0

Another cause to this issue, is using the same branch name for master & development. This is not supported and causes this error too!

1. Open the .git\config file and remove all the [gitflow* entries and save the file.
2. Init Git-Flow again, using different branch names!
No need to restart SourceTree.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.