mirror of
https://github.com/webfactory/ssh-agent.git
synced 2026-03-15 15:59:06 +08:00
Compare commits
1 Commits
v0.5.2
...
deploy-key
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
73d2440ad4 |
17
wrapper/ssh-deploy-key-wrapper.sh
Normal file
17
wrapper/ssh-deploy-key-wrapper.sh
Normal file
@@ -0,0 +1,17 @@
|
||||
#!/bin/bash
|
||||
|
||||
# The last argument is the command to be executed on the remote end, which is something
|
||||
# like "git-upload-pack 'webfactory/ssh-agent.git'". We need the repo path only, so we
|
||||
# loop over this last argument to get the last part of if.
|
||||
for last in ${!#}; do :; done
|
||||
|
||||
# Don't use "exec" to run "ssh" below; then the trap won't work.
|
||||
key_file=$(mktemp -u)
|
||||
trap "rm -f $key_file" EXIT
|
||||
|
||||
eval last=$last
|
||||
|
||||
# Try to pick the right key
|
||||
ssh-add -L | grep --word-regexp --max-count=1 $last > $key_file
|
||||
|
||||
ssh -i $key_file "$@"
|
||||
Reference in New Issue
Block a user