Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I share a git configuration?

Tags:

git

git-flow

I've initiated a new git repository using git flow, done a commit or two and pushed.

When I clone the repository in a new directory and run a git flow command I get the error:

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

The reason for the error is that the .git/config file in the newly cloned directory doesn't contain the git flow configuration.

How can I push/share the configuration so any clone of the repository will have the correct configuration?

like image 858
SimonW Avatar asked May 18 '14 15:05

SimonW


1 Answers

You cannot directly share you config

The contents of the .git folder are (intended to be) specific to an individual install.

Alternative

Instead of trying to directly share your config, consider adding a script to the repository to setup whatever config you want to share. e.g. add a file named bin/setup to the repository with these contents:

#!/usr/bin/env bash

# simple
git flow init -d

# override stuff or whatever
git config gitflow.prefix.versiontag ""
git config gitflow.prefix.feature ""

Commit it:

-> chmod +x bin/setup
-> git add bin/setup
-> git commit -m "adding a setup script to ensure consistent config"

And run it on new clones:

-> git clone ....
-> cd project
-> bin/setup
-> git config -l --local
...
gitflow.branch.master=master
gitflow.branch.develop=development
gitflow.prefix.versiontag=
gitflow.prefix.feature=
gitflow.prefix.release=release/
gitflow.prefix.hotfix=hotfix/
gitflow.prefix.support=support/
like image 155
AD7six Avatar answered Oct 04 '22 19:10

AD7six