Jan 10 2023
05:08 PM
- last edited on
Mar 05 2024
02:17 PM
by
TechCommunityAP
Jan 10 2023
05:08 PM
- last edited on
Mar 05 2024
02:17 PM
by
TechCommunityAP
Hi all,
I am running the following command line script to save exported dataverse solution in repo.
git config user.email "email address removed for privacy reasons"
git config user.name "User1"
git checkout main
git pull
git add --all
git commit -m "Test solution 1"
echo push code to new repo
git -c http.extraheader="AUTHORIZATION: bearer $(System.AccessToken)" push origin main -f
But the 'git checkout' is giving the following error: pathspec 'main' did not match any file(s) known to git
I am already on the main branch. I tried from git bash via my local machine and the commit works fine from there. But the pipeline action gives the above error.
Is this something related to the permission settings for the repo or the user?
Thanks in advance
Jan 17 2023 02:35 AM
Hi @A_dhanoa,
If Build Service account has contribute access on main branch below command line script should work:
git config user.email "EmailID"
git config user.name "UserName"
git checkout -b main
git pull
git add --all
git commit -m "Test solution 1"
echo push code to new repo
git -c http.extraheader="AUTHORIZATION: bearer $(System.AccessToken)" push origin main -f
The only change which I made is adding "-b" flag before branch name in above script. I have tested this in my project and it is working fine.
Let me know if above resolution works for you.
Regards,
Saksham Gupta