Running ssh-agent while debugging on MacOS
I have a project that uses a Git library (gitpython) in order to get a repo. I authenticate using an SSH key.
When running the project in my terminal on MacOS everything works well as long as I have first started the ssh-agent and added the appropriate key.
However, when running in Intellij it fails when trying to checkout the repo in my code because it does not have access to the SSH key.
I tried to edit the script that intellij installs to start from the command line by adding:
subprocess.run( [ 'ssh-agent', '-s' ], stdout=subprocess.PIPE, universal_newlines=True )
subprocess.run( [ 'ssh-add', '/Users/x/.ssh/id_rsa' ], stdout=subprocess.PIPE, universal_newlines=True )
prior to start_new_instance(ide_args), but the problem still persists.
Does anyone know how I can ensure that any time I run my script from within Intellij it will have access to an ssh-agent with the appropriate key added?
Please sign in to leave a comment.
What Run/Debug configuration type do you use?
Does it have to be the same terminal session where your script runs for the ssh-agent to work?
No it doesn't have to be the same terminal session. I am happy to use the terminal that intellij spawns - as long as it loads ssh-agent first so I can utilise my ssh key.