How to emulate withCredentials outside of jenkins

Hi, I’m calling a Python script from a sh step of a declarative script. The sh step is wrapped by withCredentials and the Python script successfully executes GitPython api calls without prompting for authentication. So that is good.

How could I emulate the withCredentials behaviour from the bash command line so that I can test the Python script outside of Jenkins?

In a shell, I would use ssh-agent to provide the credentials for an ssh based protocol.

In a shell, I would use define the same environment variables as the withCredentials step defined for the shell steps that it is calling.