[Python] SSH authentication fails if shell script is run from python

Discussão em 'Python' iniciado por Stack, Junho 26, 2025.

  1. Stack

    Stack Membro Participativo

    My .py runs a .sh which clones a git repository.

    I can git clone --bare ssh://mybitbucket.host/myrepo.git repo without any issues.

    I can also do the same form the .sh

    But when I execute the .sh from python using subprocess.check_call I see the following error:


    Cloning into bare repository 'repo'... git@mybitbucket.host: Permission denied (publickey). fatal: Could not read from remote repository
    ​

    So the .sh is being executed but somehow I can't auth with my git host.

    It appears that python or the subprocess does not have access to my ssh keys or ssh config. Is the shell script being executed in some sandbox?

    What's going on?

    Continue reading...

Compartilhe esta Página