sbt-ghpages icon indicating copy to clipboard operation
sbt-ghpages copied to clipboard

Copy user.{name,email} from parent repo

Open tvierling opened this issue 10 years ago • 2 comments

For those of us working on multiple projects with different targets (public/open-source, work/proprietary) on the same system, $HOME/.gitconfig may not contain a value for user.email, or even user.name -- or they may not be the same values as those within the project using sbt-ghpages.

It would be nice if the temporary repo copied these values from the project repo's view of git config. I just don't know where the GitRunner commands should go, as I'm not too familiar with sbt-git yet.

Essentially the git commands would be:

val userName = gr("config", "user.name")(projectRepo, s.log)
val userEmail = gr("config", "user.email")(projectRepo, s.log)
// ... then after creating the temporary clone ...
gr("config", "user.name", userName)(updatedRepo, s.log)
gr("config", "user.email", userEmail)(updatedRepo, s.log)

This would work no matter whether user.name and user.email are set locally in the repo or globally in $HOME/.gitconfig; it simply fetches what the project sees as the fully resolved values, and applies them to the gh-pages clone.

tvierling avatar Jun 10 '14 16:06 tvierling

Note: I was able to work around this temporarily by going to ~/.sbt/ghpages/default/PROJECTNAME and doing the following:

git config user.name MYNAME
git config user.email MYADDRESS
git commit --amend --reset-author
git push --force origin

which will replace the initial commit with one having the correct values. As long as ~/.sbt/ghpages/default/PROJECTNAME remains as-is, it appears to retain those values on future push operations.

tvierling avatar Jun 10 '14 21:06 tvierling

Thanks @tvierling, finding this workaround was useful. I also have different Github profiles for various repos.

ghost avatar Jan 31 '15 21:01 ghost