3
9

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

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
3
9
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
3
9

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?