I have a azure devops pipeline which checkout a github repo , i also want to have a bash task to checkout another repo and modify it , check it back in .
git clone https://$(githubApiKey)@mygithub.private.com/myrepo/ops-one-code.git
fatal: could not read Password for 'https://***@mygithub.private.com': terminal prompts disabled
CodePudding user response:
Did you generate personal access token on GitHub?
Just create new token from the below page with needed scopes:
settings > developer settings > personal access tokens > generate new token
Then use git clone command like below:
git clone https://[email protected]/myrepo/ops-one-code.git
CodePudding user response:
You can accomplish your requested task using two powershell tasks:
Task to checkout a Github repository:
- task: PowerShell@2
displayName: Checkout Repo
inputs:
targetType: 'inline'
script: |
git config user.email "user.email"
git config user.name "user.name"
Remove-Item s1 -Recurse -Force -ErrorAction Ignore
git clone https://username:$(PAT)@github.com/org/repo.git s1
cd s1
git checkout main
workingDirectory: '$(Pipeline.Workspace)'
Task to push back on the Github repository
- task: PowerShell@2
displayName: Push git changes
inputs:
targetType: 'inline'
script: |
git config user.email "user.email"
git config user.name "user.name"
git add --all
git commit -m "message"
git push https://username:$(PAT)@github.com/org/repo.git s1
workingDirectory: '$(Pipeline.Workspace)/s1'
CodePudding user response:
Problem was the azure variable was a secret and it didn’t work with it hence it prompted for the password