1

I am using SVN but I would like to change to Git for a lot of reasons.

However the thing that annoys me is that git is constantly bugging me about settings my author email and name. I work on a lot of servers and not from a single system where I could set it once and be done with it.

At the moment I am using svn and connect to the servers using ssh and the -A option which exports my authentication agent to the remote session. This way I can commit to svn repsotiries via svn+ssh protocol without having to type username/password or anything. And that on every server where a checkout of the repository is, without having to set environment variables or anything.

Is something like this possible with git?

Maby just ignore the author settings or store them on the git server associated with the key that is used for authentication? Is this a server or a client thing?

  • Just copy your .gitconfig to all the servers you regularly use. – Zoredache Aug 11 '14 at 16:42
  • Or put your store the username, as part each copy of your repositories. dereenigne.org/git/… – Zoredache Aug 11 '14 at 16:47
2

Author/committer settings can be specified with the following environment variables:

GIT_AUTHOR_NAME
GIT_COMMITTER_NAME
GIT_AUTHOR_EMAIL
GIT_COMMITTER_EMAIL

Once you've done that, you can tell your ssh to export the variables when connecting to remote servers. This is done by editing your ~/.ssh/config. Add something like this:

SendEnv GIT_*

The problem is that the remote server must be configured to accept those variables, so the /etc/ssh/sshd_config (or wherever your server's configuration is stored) may need to be modified:

AcceptEnv GIT_*

Once that's done, the remote git should be able to utilize those variables without bugging you anymore.

More about sending the environment variables over ssh: When ssh'ing, how can I set an environment variable on the server that changes from session to session?

|improve this answer|||||
  • for completeness' sake I should point out that sshd will need to be reloaded after the configuration changes have been introduced: /etc/init.d/ssh reload – AtomHeartFather Aug 11 '14 at 16:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.