简体   繁体   中英

Git bash keeps asking for ssh passphrase when pushing to Bitbucket repo

I've set up a new project on Bitbucket (private repo) and have followed their instructions ( Set up an SSH key ) to create an SSH key for when working with Bitbucket in my new Android Studio project. Everything is set up correctly to the best of my knowledge and yet every time I wish to push/fetch, Android Studio keeps asking for my passphrase.

Just to elaborate, I've followed these steps:

  1. Set up a new private repo in Bitbucket
  2. Set up the SSH key
  3. Created a new Android Studio project
  4. Set up Version Control in Android Studio and added files to the staging area and committed these using the GUI interface, followed by defining the remote URL as the SSH URL specified in the repo, at git@bitbucket.org:myusername/myreponame. This step works fine without prompting for my passphrase.
  5. Attempt to add/commit/push changes via the embedded git bash terminal - keeps asking for the passphrase.

To clarify, I've also checked the config file for Android Studio and it is using the correct SSH URL. Finally, I've scoured many sources online for a solution and have done the obvious so far, including restarting Android Studio and my PC (Windows), yet the problem persists.

请运行此命令,其中〜/ .ssh是您的公共密钥的路径

ssh-add -K ~/.ssh/id_rsa

You need an ssh-agent . That's what caches the passphrase .

Try the following on git bash:

eval $(ssh-agent)

# Change this if needed
key='~/.ssh/id_rsa'

ssh-add $key

See also:

https://unix.stackexchange.com/questions/12195/how-to-avoid-being-asked-passphrase-each-time-i-push-to-bitbucket

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM