Run git commands on Octopus Deploy server

Hi team,
After some failed attempts to integrate GitHub as an external feed on the Octopus server, we decided to just be able to run git commands via the inline source code process.
The problem is that this command is not recognized when we run it using this process. We have installed the git application on the EC2 instance where the Octopus Deploy server is installed. So, the question is: isn’t this the prerequisite for the Octopus Server to run git as an inline process i.e. to install git (or any other prerequisites) to the location where it is installed?
If not, any help is appreciated.
Thank you.

hi @1n3l4st1c !

Usually in scenarios like this, it’s just that a restart of the Octopus server service is required to pick up an updated PATH variable. As the environment variables are effectively snapshotted when the service starts, further edits won’t be picked up by Octopus or any of it’s child processes.

I hope this helps, and please let me know if you have any further questions!

1 Like

Hi Justin,

Thank you very much for your reply. I added the git path on the PATH and restarted the service. Now when i run the git clone command on an inline it recognizes the command but i get an error
Cloning into ‘OctopusCLI’…
Also, when the repo is cloned, in which directory will i find it?
Thank you again.

Hi @1n3l4st1c !

Great news that got your issue resolved! When Octopus runs an action, it is performed in a transient Work directory, that is cleaned up at the end of the deployment. If you wanted that data to persist after the script/deployment is finished, I would suggest performing switching to a different directory before performing the git clone, or perhaps copying the folder or whatever subset of folders to a different location as part of your script.

1 Like

Excellent. It worked. Thank you vey much Justin.

1 Like

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.