# at server
$ pwd
/home/YOURNAME
$ ruby create_empty_bare_repository.rb
Initialized empty Git repository in /home/YOURNAME/cixawa-20170509100453.git/
cixawa-20170509100453.git is created.
You'll execute following commands locally.
----
mkdir cixawa-20170509100453
cd cixawa-20170509100453
git init
echo Hello > README
git add .
git commit -m 'Initial commit.'
git remote add origin ssh://[email protected]:/home/YOURNAME/cixawa-20170509100453.git
git push origin master
git remote -v
Last active
May 9, 2017 01:05
-
-
Save hyuki0000/9e8930cd57bb4ba8aed8729c9bce69f5 to your computer and use it in GitHub Desktop.
create_empty_bare_repository - 一時的なgitリポジトリをサーバに作るRubyスクリプト
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/ruby | |
USERNAME = 'YOURNAME' | |
HOSTNAME = 'EXAMPLE.COM' | |
C = "bcdfghjkmnpqrstuvwxyz" | |
V = "aeiou" | |
prefix = '' | |
3.times do | |
prefix += C[Random.rand(C.size)] + V[Random.rand(V.size)] | |
end | |
name = Time.now.strftime("#{prefix}-%Y%m%d%H%M%S") | |
dirname = Time.now.strftime("#{name}.git") | |
system("mkdir #{dirname}") | |
Dir.chdir dirname | |
system("git init --bare") | |
puts | |
puts "#{dirname} is created." | |
puts "You'll execute following commands locally." | |
puts "----" | |
puts "mkdir #{name}" | |
puts "cd #{name}" | |
puts "git init" | |
puts "echo Hello > README" | |
puts "git add ." | |
puts "git commit -m 'Initial commit.'" | |
puts "git remote add origin ssh://#{USERNAME}@#{HOSTNAME}:/home/#{USERNAME}/#{dirname}" | |
puts "git push origin master" | |
puts "git remote -v" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment