- Newest
- Most votes
- Most comments
Hello.
Try restarting EC2 after adding the Git path to the environment variables.
After adding Git to the system environment variable path, I restarted EC2 and executed Systems Manager RunCommand, and the Git command was executed successfully.
https://stackoverflow.com/questions/58293277/use-systems-manager-to-run-aws-cli-commands-on-windows-ec2-instance
https://stackoverflow.com/questions/4492979/error-git-is-not-recognized-as-an-internal-or-external-command
Verify PATH Environment Variable:
Connect to your EC2 instance and run the following command in PowerShell:
$env:Path
Check Script Execution Policy:
Run the following command to check your script execution policy:
Get-ExecutionPolicy
Explicitly Call Git:
Instead of relying on the PATH environment variable, explicitly call the Git executable within your script. PowerShell
& "C:\Program Files\Git\bin\git.exe" --version
For more to troubleshoot the issue follow the link:
https://docs.aws.amazon.com/systems-manager/latest/userguide/troubleshooting-ssm-agent.html
Relevant content
- asked 3 years ago

If the settings are configured correctly, you can check the Git version as shown below.