Our projects repos hosting on github.
How I make backup (clone all repos using cron + github api) probably there is other way how to make backup, but I don`t find this way.
#!/usr/bin/ruby
require 'rubygems'
require 'octokit'
$git_binary = '/usr/bin/git'
$git_login = "LOGIN"
$git_password = "PASSWORD"
$clone_path = "/home/git"
client = Octokit::Client.new(:login => "#{$git_login}", :password => "#{$git_password}")
repos = client.organization_repositories("ORGANIZATION")
system ("rm -rf #{$clone_path}/ORGANIZATION")
repos.each do |num|
system ("#{$git_binary} clone --mirror --recursive https://#{$git_login}:#{$git_password}@github.com/#{num.full_name} #{$clone_path}/#{num.full_name}")
end
require 'rubygems'
require 'octokit'
$git_binary = '/usr/bin/git'
$git_login = "LOGIN"
$git_password = "PASSWORD"
$clone_path = "/home/git"
client = Octokit::Client.new(:login => "#{$git_login}", :password => "#{$git_password}")
repos = client.organization_repositories("ORGANIZATION")
system ("rm -rf #{$clone_path}/ORGANIZATION")
repos.each do |num|
system ("#{$git_binary} clone --mirror --recursive https://#{$git_login}:#{$git_password}@github.com/#{num.full_name} #{$clone_path}/#{num.full_name}")
end
0 Comments.