Created
December 20, 2011 00:43
-
-
Save johnweldon/1499642 to your computer and use it in GitHub Desktop.
Revisions
-
johnweldon revised this gist
Dec 20, 2011 . 1 changed file with 36 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -20,3 +20,39 @@ Definition : } | out-null } $ gcm addkey-sshagent | fl Name : addkey-sshagent CommandType : Function Definition : if($env:SSH_AGENT_PID) { $private:gp = get-gitbinpath if($private:gp) { & (join-path $private:gp "ssh-add") (join-path $env:USERPROFILE "/.ssh/id_rsa") } } $ gcm get-gitbinpath | fl Name : get-gitbinpath CommandType : Function Definition : $private:gp = (gcm git -ErrorAction SilentlyContinue) if($private:gp) { $private:pth = split-path (split-path $private:gp.Definition) return join-path $private:pth "bin" } return $null -
johnweldon created this gist
Dec 20, 2011 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,22 @@ $ gcm start-sshagent | fl Name : start-sshagent CommandType : Function Definition : if($env:SSH_AGENT_PID) { echo "ssh-agent running"; return } $private:gp = get-gitbinpath if($private:gp) { $private:out = & (join-path $private:gp "ssh-agent") $private:out | ?{$_.contains("=")} | %{ $private:cur = $_.split(";")[0] $private:pair = $private:cur.split("=") $private:cmd = ('$env:{0}="{1}"' -f $private:pair) invoke-expression $private:cmd } write-warning "Use exit to leave shell" register-engineevent powershell.exiting -action { ps -Id $env:SSH_AGENT_PID -ErrorAction SilentlyContinue | stop-process } | out-null }