LoginSignup
1
6

More than 3 years have passed since last update.

ssh-agentを自動起動する

Posted at

vscodeのドキュメントに良いまとめがあった。
https://code.visualstudio.com/docs/remote/troubleshooting#_setting-up-the-ssh-agent

Windowsの場合、管理者権限でPowerShellを起動して以下のコマンドを実行する。

Set-Service ssh-agent -StartupType Automatic
Start-Service ssh-agent
Get-Service ssh-agent

*nuxの場合、.bash_profileなどに書いておく。

if [ -z "$SSH_AUTH_SOCK" ]
then
  # Check for a currently running instance of the agent
  RUNNING_AGENT="`ps -ax | grep 'ssh-agent -s' | grep - grep | wc -l | tr -d '[:space:]'`"
  if [ "$RUNNING_AGENT" = "0" ]
  then
    # Launch a new instance of the agent
    ssh-agent -s &> .ssh/ssh-agent
  fi
  eval `cat .ssh/ssh-agent`
fi
1
6
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
6