aboutsummaryrefslogtreecommitdiff
path: root/gitmove
blob: 90a943d32b4b7de7a21bbbd90fb236be20c526df (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/usr/bin/env ruby
#!DESCRIBE: Migrate repos to gitolite

iam = "me"
from = "git@github.com:Me/"
to = "git@gitolite:"
repos = %w( ... )

File.open("repos.conf", ?w) do |f|
  repos.each do |r|
    f.puts "repo #{r}"
    f.puts "  RW+ = #{iam}"
  end
end

File.open("repos.script", ?w) do |f|
  f.puts "#!/bin/bash"
  repos.each do |r|
    f.puts "git clone --bare #{from}#{r} __repo_#{r}"
    f.puts "cd __repo_#{r}"
    f.puts "git push --all #{to}#{r}"
    f.puts "git push --tags #{to}#{r}"
    f.puts "cd .."
    f.puts "rm -rf __repo_#{r}"
    f.puts
  end
end

File.chmod(0744, "repos.script")

puts "Done generating; now push the contents of repos.conf to your gitolite config, then run the repos.script script."