Skip to content

Commit 4e92168

Browse files
committed
Support Vagrant: quick & easy Linux virtual machine setup
When developing Git for Windows, we always have to ensure that we do not break any non-Windows platforms, e.g. by introducing Windows-specific code into the platform-independent source code. At other times, it is necessary to test whether a bug is Windows-specific or not, in order to send the bug report to the correct place. Having access to a Linux-based Git comes in really handy in such a situation. Vagrant offers a painless way to install and use a defined Linux development environment on Windows (and other Operating Systems). We offer a Vagrantfile to that end for two reasons: 1) To allow Windows users to gain the full power of Linux' Git 2) To offer users an easy path to verify that the issue they are about to report is really a Windows-specific issue; otherwise they would need to report it to [email protected] instead. Using it is easy: Download and install https://www.virtualbox.org/, then download and install https://www.vagrantup.com/, then direct your command-line window to the Git source directory containing the Vagrantfile and run the commands: vagrant up vagrant ssh See https://github.com/git-for-windows/git/wiki/Vagrant for details. As part of switching Git for Windows' development environment from msysGit to the MSys2-based Git SDK, this Vagrantfile was copy-edited from msysGit: https://github.com/msysgit/msysgit/blob/0be8f2208/Vagrantfile Signed-off-by: Johannes Schindelin <[email protected]>
1 parent 3008c0f commit 4e92168

File tree

2 files changed

+60
-0
lines changed

2 files changed

+60
-0
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -266,3 +266,6 @@ Release/
266266
/UpgradeLog*.htm
267267
/git.VC.VC.opendb
268268
/git.VC.db
269+
/.vagrant/
270+
/vagrant2[0-9][0-9][0-9]*-*-*
271+
/d2[0-9][0-9][0-9]*-*-*

Vagrantfile

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
# -*- mode: ruby -*-
2+
# vi: set ft=ruby :
3+
4+
# This Vagrantfile defines the requirements of a Linux development environment
5+
# to develop/run Git. This environment can be set up conveniently by installing
6+
# Vagrant and VirtualBox and calling "vagrant up" in the /usr/src/git directory.
7+
#
8+
# See https://github.com/git-for-windows/git/wiki/Vagrant for details.
9+
10+
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
11+
VAGRANTFILE_API_VERSION = "2"
12+
13+
$provision = <<PROVISION
14+
apt-get update
15+
apt-get install -y make gcc libexpat-dev libcurl4-openssl-dev gettext tk8.6 libsvn-perl
16+
17+
# clean .profile in case we're re-provisioning
18+
n="$(grep -n 'cd /vagrant' < /home/vagrant/.profile 2> /dev/null |
19+
sed 's/:.*//')"
20+
test -z "$n" || {
21+
head -n $(($n-1)) < /home/vagrant/.profile > /tmp/.profile
22+
mv /tmp/.profile /home/vagrant/.profile
23+
}
24+
25+
# add a nice greeting
26+
cat >> /home/vagrant/.profile << \EOF
27+
28+
cd /vagrant/
29+
export PATH=/home/vagrant/bin:$PATH
30+
cat << \TOOEOF
31+
32+
Welcome to the Vagrant setup for Git!
33+
--------------------------------------
34+
35+
To build & install Git, just execute
36+
37+
make -j NO_PERL_MAKEMAKER=t install
38+
39+
For more information, see https://github.com/git-for-windows/git/wiki/Vagrant
40+
TOOEOF
41+
EOF
42+
43+
cat << EOF
44+
45+
Now that everything is set up, connect to the Vagrant machine with the command:
46+
47+
vagrant ssh
48+
49+
EOF
50+
PROVISION
51+
52+
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
53+
config.vm.box = "ubuntu/trusty64"
54+
config.vm.box_url = "https://atlas.hashicorp.com/ubuntu/boxes/trusty64"
55+
56+
config.vm.provision :shell, :inline => $provision
57+
end

0 commit comments

Comments
 (0)