gitcfg: refactor config reading into a function