After spending number of hours trying to move a simple single branch SVN repository to Git that can be accessed over https, here are the steps taken.
Assume my_svn_repository
is defined by url https://127.0.0.1/svn/my_svn_repository
.
First, a list of all svn committers is needed. Save the list in a file ./authors.txt
user1 = user1 <user1@someserver.com> user2 = user2 <user2@someserver2.com>
Secondly, clone SVN repos
cd ~/tmp/git/
git svn clone https://127.0.0.1/svn/my_svn_repository --authors-file=./authors.txt git_temp_repository
Thirdly, clean svn:ignore properties
cd git_temp_repository
git svn show-ignore > .gitignore
git add .gitignore
git commit -m 'Cleaning svn:ignore properties'
In the step four, clone temp repository to a bare git repos:
git clone --bare ~/tmp/git/git_temp_repository my_git_repository.git
To setup nginx password protected server that serves only https, first install fcgiwrap
apt-get install fcgiwrap
and add config file:
server {
listen 80;
server_name git.myserver.com;
return 301 https://$host$request_uri;
}
server {
listen 443 ssl;
server_name git.myserver.com;
ssl on;
ssl_certificate /etc/nginx/ssl/nginx.crt;
ssl_certificate_key /etc/nginx/ssl/nginx.key;
access_log /var/log/nginx/git.access.log;
error_log /var/log/nginx/git.error.log;
auth_basic "Restricted";
auth_basic_user_file /etc/awstats/.htpasswd;
location ~ /git(/.*) {
fastcgi_pass unix:/var/run/fcgiwrap.socket;
include /etc/nginx/fastcgi_params;
fastcgi_param SCRIPT_FILENAME /usr/lib/git-core/git-http-backend;
fastcgi_param GIT_HTTP_EXPORT_ALL "";
fastcgi_param GIT_PROJECT_ROOT /home/git/tmp/git;
fastcgi_param PATH_INFO $1;
fastcgi_param REMOTE_USER $remote_user;
}
}
On client
git -c http.sslVerify=false clone https://sasa@git.myserver.com/git/my_git_repository.git
http.sslVerify=false is used to allow self signed certificates during development.