WebFaction
Community site: login faq

I've installed gitolite in my webfaction account with other user different from my main user.

For example: gitoliteuser and myaccountuser.

I have my git repositories in /home/gitoliteuser/repositories/repo.git And my webapp in /home/myaccountuser/webapps/repo

I want to automatic pull my webapp when i push from local to my git.

I've tried with:

unset $(git rev-parse --local-env-vars) cd /home/demssite/webapps/top100 git pull origin develop

But It doens't work cause i need to change user, but i don't know how.

Can anybody help me about this?

Thanks in advance. Diego

asked 30 Aug '13, 04:42

demssite
123
accept rate: 0%


Hello,

The main problem with your approach is that you are trying to perform the "git pull" as the wrong user. You need to perform that action as the 'myaccountuser', not 'gitoliteuser'. You can accomplish your goal by using ssh with keys.

First, create SSH keys that enable automated logins from 'gitoliteuser' to 'myaccountuser':

ssh-keygen -t rsa # Press Enter a bunch of times...
cat $HOME/.ssh/id_rsa.pub | ssh myaccountuser@127.0.0.1 cat '>>$HOME/.ssh/authorized_keys'

Your 'gitoliteuser' should now be able to run commands like this without a password prompt:

ssh myaccountuser@127.0.0.1 pwd
ssh myaccountuser@127.0.0.1 whoami

Once you get that working, you would put something like this into your gitolite repository's post-commit and post-receive hooks (or just make one a symlink of the other):

ssh myaccountuser@127.0.0.1 cd /home/myaccountuser/webapps/top100 \&\& git pull origin develop

After that, your webapp's repository and workarea will be synchronized with the gitolite repo automatically.

Any questions?

~Christopher S, WebFaction Support

permanent link

answered 30 Aug '13, 14:40

likebike
3366
accept rate: 28%

edited 30 Aug '13, 14:43

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×111
×9
×2

question asked: 30 Aug '13, 04:42

question was seen: 2,822 times

last updated: 30 Aug '13, 14:43

WEBFACTION
REACH US
SUPPORT
AFFILIATE PROGRAM
LEGAL
© COPYRIGHT 2003-2019 SWARMA LIMITED - WEBFACTION IS A SERVICE OF SWARMA LIMITED
REGISTERED IN ENGLAND AND WALES 5729350 - VAT REGISTRATION NUMBER 877397162
5TH FLOOR, THE OLD VINYL FACTORY, HAYES, UB3 1HA, UNITED KINGDOM