+1 vote
1 view
in Azure by (32.3k points)

I tried the following approach in my build script:

git -c http.extraheader="AUTHORIZATION: bearer %SYSTEM_ACCESSTOKEN%" pull ...

It seemed to work for commands like pull, etc. But when I was trying to push the changes, I got the below error:

fatal: unable to access 'https://example.visualstudio.com/SampleTeam/_git/SampleRepo/': SSL read: error:00000000:lib(0):func(0):reason(0), errno 10054


1 Answer

+1 vote
by (16.8k points)
edited by

Hey, here are some key steps that you should follow:

Grant version control permissions to the build service

Are you interested in learning Azure from basics! Here's the right video for you on Azure provided by Intellipaat:

Go to the Version Control control panel tab

Team Services: https://{your-account}.visualstudio.com/DefaultCollection/{your-team-project}/_admin/_versioncontrol

On-premises: https://{your-server}:8080/tfs/DefaultCollection/{your-team-project}/_admin/_versioncontrol

On the Version Control tab, select the repository in which you want to run Git commands, and then select Project Collection Build Service (account_name). Grant permissions needed for the Git commands you want to run. Typically you'll want to grant:

Branch creation: Allow

Contribute: Allow

Read: Inherited allow

Tag creation: Inherited allow

When you're done granting the permissions, make sure to click Save changes.

Enable your build definition to run Git.exe

On the variables tab set this variable: system.prefergit = true 

On the options tab select Allow scripts to access OAuth token.

Also, make sure to follow this document: https://www.visualstudio.com/en-us/docs/build/scripts/git-commands

Welcome to Intellipaat Community. Get your technical queries answered by top developers !