zoukankan      html  css  js  c++  java
  • SSH Key Still asking for password and passphrase

    SSH Key - Still asking for password and passphrase

    回答1

    Add Identity without Keychain

    There may be times in which you don't want the passphrase stored in the keychain, but don't want to have to enter the passphrase over and over again.

    You can do that like this:

    ssh-add ~/.ssh/id_rsa 
    

    This will ask you for the passphrase, enter it and it will not ask again until you restart.

    Add Identity Using Keychain

    As @dennis points out in the comments, to persist the passphrase through restarts by storing it in your keychain, you can use the -K option (-k for Ubuntu) when adding the identity like this:

    ssh-add -K ~/.ssh/id_rsa
    

    Once again, this will ask you for the passphrase, enter it and this time it will never ask again for this identity.

    评论:

    Note that this won't persist the identity on restarts. You can use the -K option to store the passphrase in your keychain when adding it, e.g. ssh-add -K ~/.ssh/id_rsa

    – Dennis

    Oct 27 '15 at 10:23

    回答2

    If you work with HTTPs urls, it'll always ask for your username / password.

    If you're correctly using SSH when cloning / setting remotes. Then make sure you have a ssh-agent to remember your password. That way, you'll only enter your passphrase once by terminal session.

    If it is still too annoying, then simply set a ssh-key without passphrase.

    评论:

    I just want to note that passphrases are used to encrypt your private key, so if you don't use a passphrase, then your private key will be unencrypted on your machine. It's like leaving a password in a text file laying around on your computer.
    – user456814
    Jul 5 '14 at 17:25

    回答3

    If you're using windows, this worked for me:

    eval `ssh-agent -s`
    ssh-add ~/.ssh/*_rsa
    

    It'll ask for passphrase in the second command, and that's it.

    How to avoid being asked passphrase each time I push to Bitbucket

    回答1

    You need to use an ssh agent. Short answer: try

    $ ssh-add
    

    before pushing. Supply your passphrase when asked.

    If you aren't already running an ssh agent you will get the following message:

    Could not open a connection to your authentication agent.
    

    In that situation, you can start one and set your environment up thusly

    eval $(ssh-agent)
    

    Then repeat the ssh-add command.

    It's worth taking a look at the ssh agent manpage.

    回答2

    Create (or edit if it exists) the following ~/.ssh/config file:

    Host *
        UseKeychain yes
        AddKeysToAgent yes
        IdentityFile ~/.ssh/id_rsa
    
  • 相关阅读:
    [转]ASP.NET 导出Excel 80070005错误解决备忘
    [转]整理.net程序集加载方法
    Jquery示例
    WQL测试工具
    asp.net 2.0的事务问题
    <转>xPath教程
    .NET代码编写规范
    sqlserver2005 技巧
    MySQL(5.0)导出导入
    Castle ActiveRecord 笔记
  • 原文地址:https://www.cnblogs.com/chucklu/p/15437491.html
Copyright © 2011-2022 走看看