Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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
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


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.