Skip to content

Instantly share code, notes, and snippets.

@fcoury
Created April 22, 2009 10:40
Show Gist options
  • Save fcoury/99710 to your computer and use it in GitHub Desktop.
Save fcoury/99710 to your computer and use it in GitHub Desktop.
config = {}
group = nil
File.foreach("#{ENV['HOME']}/.gitconfig") do |line|
line.strip!
if line[0] != ?# and line =~ /\S/
if line =~ /^\[(.*)\]$/
group = $1
else
key, value = line.split("=")
(config[group]||={})[key.strip] = value.strip
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment