6

I edit files under Git control with Emacs 23.3.1/TRAMP/VC sudoed over an ssh connection (/sudo:sudouser@host:file with tramp-default-proxies-alist set accordingly). sudouser is a shared account, so I don't want to set user.email/user.name globally, but instead use GIT_AUTHOR_NAME/GIT_AUTHOR_EMAIL/GIT_COMMITTER_NAME/GIT_COMMITTER_EMAIL to set it just for my connection.

I did not find a way to set an environment/change the command in vc-git itself. Adding the environment variables to tramp-remote-process-environment:

(add-to-list 'tramp-remote-process-environment "GIT_AUTHOR_EMAIL=tim@tim-landscheidt.de")
(add-to-list 'tramp-remote-process-environment "GIT_AUTHOR_NAME='Tim Landscheidt'")
(add-to-list 'tramp-remote-process-environment "GIT_COMMITTER_EMAIL=tim@tim-landscheidt.de")
(add-to-list 'tramp-remote-process-environment "GIT_COMMITTER_EMAIL='Tim Landscheidt'")

works, but I fear it might bite me in the future when I want to work on a host where I need another identity.

Is there a way to set a different author/committer limited to one TRAMP connection?

Tim Landscheidt
  • 1,400
  • 1
  • 15
  • 20

1 Answers1

2

I know nothing of TRAMP, but I can point out that you can set user.email and user.name individually for a particular repository by setting them in .git/config or by doing the commands:

git config --local user.name "Tim Landscheidt"
git config --local user.email "tim@tim-landscheidt.de"

So that way you can have different settings for author/committer for each repository.

Klas Mellbourn
  • 42,571
  • 24
  • 140
  • 158
  • Whether the identity is set in `~/.gitconfig` or `.git/config` doesn't matter; the problem is that it is a shared account, and I don't want others (accidentally) posing as myself. – Tim Landscheidt Jun 03 '13 at 21:48