How to open GIT bash and give clone commands using batch file

664 views Asked by At
Start "" "%PROGRAMFILES%\Git\bin\sh.exe" --login 
cd E:
git clone SshLink

The above command is first opening normal cmd and then E: drive and then gitbash shell. I just want to open git-shell directly and change the directory to E: drive and give clone command.

1

There are 1 answers

2
VonC On

You could try:

Start "" "%PROGRAMFILES%\Git\bin\bash.exe" -c "cd /e; git clone SshLink; bash"

That will open a bash, go to the drive E and try the git clone
The final bash allows for the session to not close immediately.


Other option, as mentioned in the comments by Compo:

Start /d E:\ "%ProgramFiles%\Git\bin\bash.exe" -c "git clone SshLink; bash"

That would use the /d option of start.