ちょっとした実験用のgitリポジトリをつくる。ローカルのディレクトリに作ってもよいけど、windowsだとsshが面倒そうだったので、dockerにした。
環境
Dockerfile
FROM ubuntu:16.04 RUN apt-get update && apt-get install -y openssh-server RUN apt-get install -y git RUN mkdir /var/run/sshd RUN echo 'root:a' | chpasswd RUN sed -i 's/PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config # SSH login fix. Otherwise user is kicked off after login RUN sed 's@session\s*required\s*pam_loginuid.so@session optional pam_loginuid.so@g' -i /etc/pam.d/sshd ENV NOTVISIBLE "in users profile" RUN echo "export VISIBLE=now" >> /etc/profile EXPOSE 22 CMD ["/usr/sbin/sshd", "-D"]
- 基本的には、公式のrootでsshdを起動する https://docs.docker.com/engine/examples/running_ssh_service/#run-a-test_sshd-container をコピペしただけ。
- プラスgitのインストール
- rootのパスワードを面倒なので短いものに変更
以上でイメージをビルド。
docker build -t eg_sshd .
22番ポートを適当にフォワードする。
docker run -d -p 32768:22 --name test_sshd eg_sshd
適当なsshクライアントで接続できればOK
gitのリポジトリつくる
適当にリポジトリを作る。
# mkdir sample.git # cd sample.git/ # git --bare init --shared Initialized empty shared Git repository in /root/sample.git/
git clone
windows側からgit cloneする。
git clone ssh://root@localhost:32768/root/sample.git
rootでログインしてるけど使い捨てのコンテナだからまぁ良いや、という判断。