-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Windows
This page outlines the installation of the gitflow scripts on the three major distributions of git. Please follow the directions for your git distribution.
For Windows users, Git for Windows is a good starting place for installing git. Git for Windows also includes Git-flow.
For Windows users who wish to use the automated install, it is suggested that you install Cygwin
first to install tools like git
, util-linux
and wget
(with those three being packages that can be selected
during installation). Then simply run this command from a Cygwin shell in your $HOME
:
$ wget -q -O - --no-check-certificate https://github.com/nvie/gitflow/raw/develop/contrib/gitflow-installer.sh | bash
If you are on a restricted user account, you can switch the installation location with the INSTALL_PREFIX environment variable:
$ export INSTALL_PREFIX=$USERPROFILE/bin
# Run wget command above
Of course, the location you install to should be in $PATH
If you get the error "flags: FATAL unable to determine getopt version" error after
$ git flow init
you need to install the util-linux
package using the Cygwin setup.
If you get something like "$'\r': command not found" then it's a problem with your line endings. You should run the following:
$ sed -i 's/\n\r/\n/mg' /usr/local/bin/git-flow*
$ sed -i 's/\n\r/\n/mg' /usr/local/bin/gitflow-*
If the above doesn't work for you (as it didn't in my case), you can use the command dos2unix
(can be installed via Cygwin setup):
$ dos2unix /usr/local/bin/git-flow*
$ dos2unix /usr/local/bin/gitflow-*
Download and install getopt.exe
from the util-linux package into C:\Program Files\Git\bin
. (Only getopt.exe
, the others util-linux files are not used). Also install libintl3.dll
and libiconv2.dll
from the Dependencies packages (libintl and libiconv), into the same directory.
Clone the git-flow sources from GitHub:
$ git clone --recursive git://github.com/nvie/gitflow.git
$ cd gitflow
NB. if you have to access Git over https, run this command to automatically convert the Git url (including for the submodule).
$ git config --global url."https://github".insteadOf git://github
Run the msysgit-install
script from a command-line prompt (you may have to
run it with Full Administrator rights if you installed msysgit with its
installer, and ensure you're running from a Windows command prompt, not MINGW):
C:\gitflow> contrib\msysgit-install.cmd "[path to git installed folder]"
Here, [path to git installed folder] is the path where git has been installed e.g. C:\Program Files (x86)\Git
In Git bash create a symbolic link for git-flow so that you can actually use the $ git flow
command from any location.
$ ln -s "/C/Program Files (x86)/Git/bin/git-flow" git-flow
If the path contains the spaces then enclose them into double quotes. /C/Program Files (x86)/Git/bin/git-flow is the path where git has been installed. e.g. C:\Program Files (x86)\Git\bin becomes /C/Program Files (x86)/Git/bin/git-flow
$ git flow help
usage: git flow <subcommand>
Available subcommands are:
init Initialize a new git repo with support for the branching model.
feature Manage your feature branches.
release Manage your release branches.
hotfix Manage your hotfix branches.
support Manage your support branches.
version Shows version information.
Try 'git flow <subcommand> help' for details.
GitHub for Windows uses a portable installation of MSysGit for its shell. You'll need to follow the above instructions for MSysGit, except for two differences, both of which rely on the install location for GHfW's MSysGit install location. To find that location:
Navigate to the GitHub directory under the OS's "Local Application Data" directory. On Windows 7, it is located at: "%LOCALAPPDATA%\GitHub\Portab~1".
Once you have the location, use it to perform the following (refer to the above MSysGit instructions above for more details):
Copy getopt.exe
, libintl3.dll
and libiconv2.dll
to the bin
directory directly under the location found above. In Windows 7, you would copy the files to: "%LOCALAPPDATA%\GitHub\Portab~1\bin"
.
Open the GitHub for Windows Git Shell and check that you are in the GitHub root directory e.g. C:\GitHub>
Clone the GitFlow folder with
C:\GitHub> git clone --recursive git://github.com/nvie/gitflow.git
This will clone the GitFlow code into a new gitflow
folder in your GitHub directory. You can select a different location if you prefer or you can remove the GitFlow clone later.
Change to the GitFlow directory:
C:\GitHub> cd gitflow
Run the msysgit-install
script with the location as a parameter. For example:
C:\GitHub\gitflow [develop]> contrib\msysgit-install.cmd "%LOCALAPPDATA%\GitHub\Portab~1"
Check that GitFlow is installed by calling the help:
C:\GitHub> git flow help
GitHub for Windows auto-updates itself, and when it does, you may lose GitFlow. This PowerShell script can be used to re-install things quickly. Keep this script and a local copy of the getopt.exe and two DLL files somewhere handy, and the gitflow repository in a sub-directory. Then just execute the script whenever needed.
$github = $env:LOCALAPPDATA + '\GitHub\Portab~1'
$githubBin = $github + '\bin'
Copy-Item getopt.exe $githubBin
Copy-Item *.dll $githubBin
Invoke-Expression ".\gitflow\contrib\msysgit-install.cmd '$github'"