xforty / vagrant-drupal

Template repo for a new drupal project built on top of a vagrant vm.
Other
46 stars 11 forks source link

git doesn't know who you are in vagrant #18

Open pearcec opened 12 years ago

pearcec commented 12 years ago

Contemplate how to get your ~/.gitconfig file into ~vagrant/.gitconfig on the host.

vagrant@ubuntu-10:~/xforty-drupal$ git commit -a [7.x 1e64d3a] Bumping versions. Committer: vagrant vagrant@ubuntu-10.04.3-server-amd64 Your name and email address were configured automatically based on your username and hostname. Please check that they are accurate. You can suppress this message by setting them explicitly:

git config --global user.name "Your Name"
git config --global user.email you@example.com

If the identity used for this commit is wrong, you can fix it with:

git commit --amend --author='Your Name <you@example.com>'

1 files changed, 2 insertions(+), 2 deletions(-)

dkingofpa commented 12 years ago

Options I could come up with off the top of my head:

  1. Somehow copy the user's .gitconfig file to the vagrant environment (possibly in the Vagrantfile). Then in one of the cookbooks create a symbolic link from /home/vagrant/.gitconfig to /vagrant/.gitconfig.vagrant.
  2. Create a chef-gitconfig cookbook to setup a .gitconfig file. Then pass git config properties in via the json list.
  3. Advise people to set up their git config as soon as they log in for the first time.
  4. Advise people to only use git in the vm for cloning. Otherwise, run the commands on the host in the shared folder.
dkingofpa commented 12 years ago

Good thread discussing this problem here.

dkingofpa commented 11 years ago

We may be able to pass along our git environment variables via ssh. Could we use the SendEnv ssh config? Something like SendEnv GIT_*

So if people want this functionality, they just have to set Git environment variables on their host and add the SendEnv to their ssh config.

We would also need to modify the ssh daemon config to accept SendEnv. Is it off by default?

Would SendEnv work with vagrant ssh?

Some (all?) of the Git environment variables we want to pass along: GIT_AUTHOR_NAME GIT_AUTHOR_EMAIL GIT_AUTHOR_DATE GIT_COMMITTER_NAME GIT_COMMITTER_EMAIL GIT_COMMITTER_DATE

Thanks Andy!