I am trying to automate git cloning of several repositories using Python.Ideally I do not want to have any user intervention when cloning of repositories starts. But I am ending up with prompts listed below for each repository cloning where I have to provide password and confirm ssh authenticity.
python gitClone.py
Enter Git Local Repository Folder [~/git/work] :
Enter Git Password for user '<user>' :
...Cloning into '~/git/work/xxx' ....
The authenticity of host 'github.com (xx.xxx.xxx.xxx)' can't be established.
ECDSA key fingerprint is
ECDSA key fingerprint is
Are you sure you want to continue connecting (yes/no)? y
Password for 'https://<user>@gitlfs.com':
gitClone.py
input2 = getpass.getpass(prompt="Enter Git Password for user '" + current_user + "' :")
if(input2):
os.environ["GIT_PASSWORD"] = input2
git_command = ['/usr/bin/git','lfs', 'clone','--config', 'core.askpass=git_askpass_helper.sh', '-b', branch, "git@github.com:myOrg/" + name + '.git']
print("\n...Cloning into '" + local_dir + "/" + name + "' ....")
git_query = Popen(git_command, cwd=local_dir, stdout=PIPE, stderr=PIPE, env=dict(os.environ, GIT_SSH_COMMAND="ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyCheck=no"))
(git_status, error) = git_query.communicate()
if git_query.poll() == 0:
print("\nCloning of Git Project myOrg/" + name + " Done!")
else:
print("\nError in Cloning Git Project myOrg/" + name + "\n" + error)
git_askpass_helper.sh
#!/bin/sh
echo "$GIT_PASSWORD"
I don't want to have to provide git passsword or confirm ssh authenticity for each repository cloning.