cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
4942
Views
0
Helpful
5
Replies

GIT bash through Powershell activity

Anish Somadevan
Level 1
Level 1

I need to create a ssh key pair for Azure VM, and i use GIT bash for it. Am able to open the GIT bash through my local windows powershell using the following command

& 'C:\Program Files (x86)\Git\bin\sh.exe' --login

openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout newprivate.key -out mykey.pem

exit

But when i try the same through a CPO power shell activity, the process keeps running and gets timed out. I tried with the command to open the GIT bash alone in the powershell script,but that too got timed out.

Could anyone please suggest on how to open the GIT bash through a CPO power shell activity?

 

Thanks

5 Replies 5

I am not familiar with this specific executable, but a couple of questions, suggestions...

1) I am assuming sh.exe is a command line utility and is NOT a UI-executable.

2) Any chance that this command line is waiting for some interactive input? It sounds like based on its description on the internet that it is actually an interactive shell, so  it is probably expecting you to put something else into the standard input. There maybe some options (such as -c) that would allow you to run a specific command inside the shell, without interaction.

2) I assume you are using Execute Windows PowerShell Script activity. However, since all you are trying to do is execute a command, why aren't you using Execute Windows Command. Can you try that?

 

Thanks for your reply. I tried the Execute Windows Command activity. It throws errow stating invalid command. I tried the same command in my local windows command prompt and that worked fine.

Command i tried : "'C:\Program Files (x86)\Git\bin\sh.exe" --login

And i have to execute another 2 lines of command after the first command. So do i need to save my commands in a multiline variable of the process and take that as an input?

Please suggest

 I tried again having a start command before the path of the .exe . Now it runs for a long time without any output. The command now i use is,

start "C:\Program Files (x86)\Git\bin\sh.exe" --login

Tried having "-i" at the end of the command as mentioned in certain blogs. didn't work either.

Please suggest.

Does Git have to run in a windows environment or could it run in Linux? (just ideas -- I run my git setup in linux and will do some terminal adapter stuff with it)

Can you create a script that does what you want and then just call that script via CPO?

--Shaun Roberts
Principal Engineer, CX
shaurobe@cisco.com

Hi Shaun,

Thanks for your suggestion. I was able to implement using the below command in a powershell activity,

C:\Windows\SysWOW64\cmd.exe /c "C:\Users\<Username>\Git\bin\sh.exe" --login -i -c "openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout mykey.key -out mykey.pem -batch"

Review Cisco Networking for a $25 gift card