Guest User

Untitled

a guest
Jan 23rd, 2018
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.35 KB | None | 0 0
  1. #!/usr/bin/env RUBYOPT= ruby
  2.  
  3. fail('not git dir') if !File.exists?(".git/config")
  4.  
  5. storage = "~/tmp/gitmirror/"
  6. id = Dir.pwd.gsub(ENV['HOME']+"/",'').gsub(/[^\d\w]+/,'_')
  7. location = storage + id + ".git"
  8. puts "Mirror location is #{location}"
  9. system(%[git clone --mirror . #{location} 2>/dev/null])
  10. system(%[git push --mirror --force --repo=#{location}])
Add Comment
Please, Sign In to add comment