Reputation: 705
I have recently installed Git onto a Dev Server that is our Dev TFS Build agent (Server 2012 R2). When I run a command line git through remote connection, it shows git commands. However, when I run a command line build step on the TFS website, git is not a recognized command. I checked the env path variables and they're fine.
Later, I tested by making my personal computer a build agent. The build step does succeed and it recognizes git. What is the difference with the server?
Upvotes: 3
Views: 1044
Reputation: 705
Thanks for the help in figuring out the problem. Restarting is the correct way to go for most, but I do not have the power to do so.
Here is my solution: Make a batch file build step and include "PATH %PATH%; (Path to Git)"
This basically appends the git directory to the environment variable of the current session. Then I am free to use git commands in the batch file.
Upvotes: 1
Reputation: 7762
Most probably you will have to restart the agent so that the new PATH variable(which will contain git's bin dir) is loaded.
Please note that if you are running the agent from a command prompt, you will have to restart the command prompt as well
Upvotes: 1
Reputation: 59010
Restart the build agent so it picks up changed path environment variable.
Upvotes: 2