Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow for additional files for ssh-add #18

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions mingw-w64-git/start-ssh-agent.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,32 @@
@ECHO. done
)
@"!SSH_ADD!"
@IF [!SSH_ADD_ADDITIONAL_KEYFILES!] NEQ [] @(
@SET KEYS=
@FOR %%I IN (!SSH_ADD_ADDITIONAL_KEYFILES!) DO @CALL :CHECKKEY %%I
IF NOT [!KEYS!] == [] @"!SSH_ADD!" !KEYS!
)
@ECHO.
)
)

@GOTO :ssh-agent-done


@REM Functions
@REM Check if ssh key has to be added
:CHECKKEY
@ssh-add -l | @FINDSTR /c:"%1" > NUL
@IF ERRORLEVEL 1 @(
@IF EXIST "%HOME%\.ssh\%1" @(
@SET KEYS='%HOME%\.ssh\%1' %KEYS%
) ELSE (
@REM Assume full path...
@SET KEYS='%1' %KEYS%
)
)
@GOTO :EOF

:ssh-agent-done
:failure

Expand Down