I have this script which clones azure repo.
I am trying to execute git push command in it.It gives me error - fatal: not a git repository (or any of the parent directories): .git Error in pushing to AZ repo: Command 'git push https://[email protected]/xxx/yyy.git' returned non-zero exit status 128
import subprocess
def subprocess_exec(state, cmd):
try:
subprocess.check_output(cmd, shell=True)
return "Success"
except subprocess.CalledProcessError as merror:
print("Error in {}: {}".format(state, merror))
az_repo_cmd = 'git -c http.extraHeader="Authorization: Basic ' +
'PAT' + '" ' + 'clone
https://dev.azure.com/' + 'ORG_Name' + '/' + 'Project_Name' + '/_git/'
+ "Repo_Name"
if subprocess_exec("Cloning from AZ repo", az_repo_cmd) == "Success":
print("Done")
az_repo_cmd2 = 'git push
https://[email protected]/xxx/yyy.git'
subprocess_exec("pushing to AZ repo", az_repo_cmd2)
How can I use git push , git create branch etc. git commands for Azure repos using script ?