forked from gitlabhq/gitlabhq
-
Notifications
You must be signed in to change notification settings - Fork 2
Export existing repositories to gitlab
minhajuddin edited this page Dec 27, 2011
·
1 revision
Use the script below to export your existing git repositories to gitlabhq
#!/bin/bash
#get these two values from your browsers request headers when you login to *your* gitlab website
cookie='Cookie: remember_user_token=**'
csrf='X-CSRF-Token: **='
gitlab_host='git.dev' #substitute with IP if your server doesn't have a domain name
for r in $(cat repos)
do
repo=$(echo $r| cut -d':' -f 1)
path=$(echo $r|cut -d':' -f 2)
echo $repo
echo $path
curl -H $cookie -H $csrf -H 'X-Requested-With: XMLHttpRequest' -d "project[name]=$repo&project[path]=$repo&project[code]=$repo&project[description]=$repo" -i "http://$gitlab_host/projects"
cd $path
git remote add gitlab "git@$gitlab_host:$repo.git"
git push gitlab master
#git push gitlab --all #comment out the above line and uncomment this one if you want to push all branches
done
create a file named repos
with the following content
repo_name1:/home/minhajuddin/repos/repo-path
repo2:repo_path2
..