Created
October 31, 2011 21:14
-
-
Save eykanal/1328976 to your computer and use it in GitHub Desktop.
Create basic .gitconfig file
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 | |
if File.exists?(File.expand_path("~/.gitconfig")) | |
puts "~/.gitconfig file already exists, exiting." | |
exit false | |
end | |
puts '##' | |
puts '## Git stores each entry with your name, email, and a unique identifier.' | |
puts '## The following will set up Git with this information, as well as some ' | |
puts '## basic settings to make Git easier to use.' | |
puts '##' | |
puts '' | |
puts "Enter full name:" | |
full_name = gets.chomp | |
puts "Enter email address:" | |
email = gets.chomp | |
File.open(File.expand_path("~/.gitconfig"), "w") do |f| | |
f.syswrite("[user]\n") | |
f.syswrite(" name = #{full_name}\n") | |
f.syswrite(" email = #{email}\n") | |
f.syswrite("[color]\n") | |
f.syswrite(" ui = auto\n") | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment