skip to Main Content

Am getting the following error message in cmd line script while runing the pipeline in azure devops.

error: src refspec main does not match any error: failed to push some
refs to
‘https://dev.azure.com/DevendraPadhi/Project%20D/_git/Project%20D

error: pathspec ‘main’ did not match any file(s) known to git fatal:
Cannot prompt because user interactivity has been disabled. fatal:
Cannot prompt because user interactivity has been disabled. fatal:
could not read Password for
‘https://[email protected]/DevendraPadhi/Project
D/_git/Project D’: terminal prompts disabled

PLease help to overcome this

Commanad line script (GIT)

Azure pipeline Error message for Command line script

2

Answers


  1. Do you follow this doc?: Run Git commands in a script.

    Check this option in your build definition:

    enter image description here

    Login or Signup to reply.
  2. Update:

    How to Push Back to TFVC(Other steps are similar, the only different thing is the last step.):

    tf add * /recursive /noprompt  /loginType:OAuth /login:.,$env:SYSTEM_ACCESSTOKEN
    
    tf checkin * /comment:"xxx" /recursive /noprompt  /loginType:OAuth /login:.,$env:SYSTEM_ACCESSTOKEN
    

    Successfully on my side:

    enter image description here

    enter image description here

    Original Answer:

    I can reproduce your issue:

    enter image description here

    The operations that Shamrai suggested is needed, but not enough.

    You need 3 steps:

    Step1, allow script to access OAuth token

    enter image description here

    Step2, give contribute permission to build service account.

    enter image description here

    enter image description here

    Step3, use this commands to push back changes:

    git push origin HEAD:main

    (Please notice add the HEAD:)

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search