-
-
Notifications
You must be signed in to change notification settings - Fork 954
-
Hi,
I'm trying to write a script and running the script on a linux box. I need to use an user account to connect to the git repo
Currently I'm using below command to clone the repo:
remote_url = "ssh://UserA@git.corp.com:/package"
git_env = {"GIT_SSH_COMMAND":"ssh -i key -o StricktHostKeyChecking=no""}
Repo.clond_from(remote_url, "/tmp/repo",env=git_env}
The clone command works fine .But I need to commit changes and push the changes under this user account.
I didn't find any document about how to set env when commit and push the change.
Any suggestion?
Beta Was this translation helpful? Give feedback.
All reactions
Answered by
Byron
May 27, 2021
In the documentation about remotes you will find this:
ssh_cmd = 'ssh -i id_deployment_key' with repo.git.custom_environment(GIT_SSH_COMMAND=ssh_cmd): repo.remotes.origin.fetch()
which applies to pushes as well.
Replies: 1 comment
-
In the documentation about remotes you will find this:
ssh_cmd = 'ssh -i id_deployment_key' with repo.git.custom_environment(GIT_SSH_COMMAND=ssh_cmd): repo.remotes.origin.fetch()
which applies to pushes as well.
Beta Was this translation helpful? Give feedback.
All reactions
0 replies
Answer selected by
Byron
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment