Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

When using Git VCS, I execute all of the git commands on the directory that contains a .git repository. I want to execute a git-pull through an SSH trigger but how do I define the path to the repository to perform the action on?

share|improve this question

1 Answer 1

up vote 3 down vote accepted
  1. If you set the GIT_DIR environment variable, git will use it as a path to the repository.
  2. In general, you can start a subshell like this:

    (cd /some/other/directory/; git pull)

The subshell will have its own current directory and environment variables.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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