Last active
September 3, 2017 17:02
GitBucketのVagrantfile
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- mode: ruby -*- | |
# vi: set ft=ruby : | |
GITBUCKET_VERSION = "1.12" | |
HTTP_PORT = 8080 | |
SSH_PORT = 29418 | |
Vagrant.configure(2) do |config| | |
config.vm.box = "precise64" | |
config.vm.box_url = "http://files.vagrantup.com/precise64.box" | |
config.vm.network :forwarded_port, guest: HTTP_PORT, host: HTTP_PORT | |
config.vm.network :forwarded_port, guest: SSH_PORT, host: SSH_PORT | |
config.vm.provision "shell", inline: <<-EOS | |
apt-get update | |
apt-get install -y openjdk-7-jre tomcat7 | |
if [ ! -d /usr/share/tomcat7/.gitbucket ]; then | |
mkdir /usr/share/tomcat7/.gitbucket | |
chown tomcat7.tomcat7 /usr/share/tomcat7/.gitbucket | |
fi | |
cd /usr/local/src | |
wget -O gitbucket.war https://github.com/takezoe/gitbucket/releases/download/#{GITBUCKET_VERSION}/gitbucket.war | |
if [ ! -e /var/lib/tomcat7/webapps/ROOT.war ]; then | |
rm -rf /var/lib/tomcat7/webapps/ROOT | |
ln -s /usr/local/src/gitbucket.war /var/lib/tomcat7/webapps/ROOT.war | |
fi | |
EOS | |
end |
SSH接続の手順(1.12+)
-
http://localhost:8080/admin/system で "Enable SSH access to git repository" のチェックをオンにする(ポートは29418のまま)
-
http://localhost:8080/<ユーザー>/_ssh で公開鍵を登録する。作り方はこんな感じ。
$ ssh-keygen -t rsa -f ~/.ssh/<秘密鍵>
-
~/.ssh/config に接続設定を記述
Host localhost User <ユーザー> Port 29418 Hostname localhost IdentityFile ~/.ssh/<秘密鍵> TCPKeepAlive yes IdentitiesOnly yes
-
リポジトリのページに記載してあるSSHアドレスでリポジトリをclone
$ git clone ssh://<ユーザー>@localhost:29418/<ユーザー>/<リポジトリ>.git
-
あとはいつもどおりコードをガリガリ書いて commit -> push する
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Vagrant Share する手順は下記のとおり