swellaby / vsts-mirror-git-repository

A straightforward utility to mirror one Git repository to another location
MIT License
25 stars 15 forks source link

Encountered error while using the extension #87

Closed sarang3614 closed 3 years ago

sarang3614 commented 3 years ago

Got following error while using extension, might be something related to git settings where agent is hosted. Can someone please guide on how to proceed

fatal: could not read Username for 'http://abc.xyz.com': terminal prompts disabled.

calebcartwright commented 3 years ago

hello @sarang3614, could you tell us a little more about your setup? It's incredibly difficult for us to offer much guidance with the minimal information provided in the issue description.

For example:

sarang3614 commented 3 years ago

hi Team, please find answers below :

what's the host platform for the source repository? - source repository exists in gitlab does the source repository require authentication (and if so did you include that in your task configuration)? - yes, source requires authentication, and authentication is enabled through PAT. Also included in task configuration. what's the host platform for the destination repository? - host platform for destination repository is AzureDevops hosted as SAAS. is your pipeline running on the Microsoft-hosted agents or are you using a self-hosted agent? - pipeline is running on the self-hosted agent.

Do let me know if more information is required.

sarang3614 commented 3 years ago

hi team, Any suggestions on above..

calebcartwright commented 3 years ago

host platform for destination repository is AzureDevops hosted as SAAS.

Just to confirm, you've got a PAT being passed in for the destination auth field correctly right? Always need to rule out the easy problems first, as I've had a couple cases myself where I had a typo in the variable name I was using for one of those auth fields that was causing problems

sarang3614 commented 3 years ago

Yes, since it was raised, I have checked and can confirm - PAT for destination auth field is passed correctly.

calebcartwright commented 3 years ago

Could you please re-run your job with diagnostics enabled and share the log output (feel free to scrub/obfuscate anything you feel is sensitive). As an FYI for any future reports, would encourage you to leverage our bug issue template and provide the information up front as that helps to minimize the elongated back and forth dialog to try to get the requisite information

sarang3614 commented 3 years ago

Thanks for the response, attached is the log. logs_797.zip

calebcartwright commented 3 years ago

Thanks, but could you please grab the subset of your log contents relative to the task and paste it inline? You can look for a section header similar to the one shown below.

Having the relevant information inline within the issue will be easier to review, cross reference, and locate later on over an archive file that has to be downloaded/extracted/etc.


2018-12-04T23:30:15.1091356Z ##[section]Starting: Mirror Git Repository
2018-12-04T23:30:15.1094369Z ==============================================================================
2018-12-04T23:30:15.1094484Z Task         : Mirror Git Repository
2018-12-04T23:30:15.1094525Z Description  : A straightforward utility to mirror one Git repository to another location
2018-12-04T23:30:15.1094713Z Version      : 1.1.7
2018-12-04T23:30:15.1094811Z Author       : Swellaby
2018-12-04T23:30:15.1094852Z Help         : [More Information](https://github.com/swellaby/vsts-mirror-git-repository)
sarang3614 commented 3 years ago

hi, sorry, my responses are delayed due to holiday season. Below is the log snipped you are looking for : 2020-12-23T18:53:24.5578624Z ##[debug]C:\Agent\externals\git\cmd\git.exe arg: --mirror 2020-12-23T18:53:24.5579846Z ##[debug]C:\Agent\externals\git\cmd\git.exe arg: http://***@nljz32srap008.imptobnet.com/aras/plm.git 2020-12-23T18:53:24.5580423Z ##[debug]C:\Agent\externals\git\cmd\git.exe arg: PLM 2020-12-23T18:53:24.5583221Z ##[debug]exec tool: C:\Agent\externals\git\cmd\git.exe 2020-12-23T18:53:24.5583537Z ##[debug]arguments: 2020-12-23T18:53:24.5583763Z ##[debug] -c 2020-12-23T18:53:24.5584028Z ##[debug] http.sslVerify=false 2020-12-23T18:53:24.5584272Z ##[debug] clone 2020-12-23T18:53:24.5584515Z ##[debug] --mirror 2020-12-23T18:53:24.5584908Z ##[debug] http://***@xyz008.abc.com/aras/plm.git 2020-12-23T18:53:24.5585220Z ##[debug] PLM 2020-12-23T18:53:24.5590991Z [command]C:\Agent\externals\git\cmd\git.exe -c http.sslVerify=false clone --mirror http://***@nljz32srap008.imptobnet.com/aras/plm.git PLM 2020-12-23T18:53:25.2121770Z Cloning into bare repository 'PLM'... 2020-12-23T18:53:25.4628877Z fatal: could not read Password for 'http://***@xyz008.abc.com': terminal prompts disabled 2020-12-23T18:53:25.4903834Z ##[debug]Exit code 128 received from tool 'C:\Agent\externals\git\cmd\git.exe' 2020-12-23T18:53:25.4908486Z ##[debug]STDIO streams have closed for tool 'C:\Agent\externals\git\cmd\git.exe' 2020-12-23T18:53:25.5711092Z ##[debug]task result: Failed 2020-12-23T18:53:25.5739670Z ##[error]Error: The process 'C:\Agent\externals\git\cmd\git.exe' failed with exit code 128 2020-12-23T18:53:25.5749153Z ##[debug]Processed: ##vso[task.issue type=error;]Error: The process 'C:\Agent\externals\git\cmd\git.exe' failed with exit code 128 2020-12-23T18:53:25.5756193Z ##[debug]Processed: ##vso[task.complete result=Failed;]Error: The process 'C:\Agent\externals\git\cmd\git.exe' failed with exit code 128 2020-12-23T18:53:25.5784067Z ##[section]Finishing: Mirror Git Repository to https://IMBCompass@dev.azure.com/xyz/IMBCompassProject/_git/Compass_Track3

calebcartwright commented 3 years ago

hi, sorry, my responses are delayed due to holiday season.

No worries.

This line in particular looks problematic

http://@nljz32srap008.imptobnet.com/aras/plm.git

Did you strip the value from the userinfo component on the url here? (anything between the protocol and the @)

Given the above comment I am guessing that this is the self-hosted Gitlab instance, but if you didn't strip anything out of the log then this looks there's an issue with your input for the Source Repository - Personal Access Token field

For example with this config: image

The slugs show the pat (obfuscated in the logs by the agent since it's a secure variable) when configured or null when authentication isn't needed for anonymous clones:

https://***@dev.azure.com/swellaby/OpenSource/_git/mirror1

https://null@github.com/swellaby/vsts-mirror-git-repository
sarang3614 commented 3 years ago

hi @calebcartwright , yes I did strip the value before sharing. Below are the actual values. image

You are right, this is self (Organization) hosted GitLab instance. image. The input from the source repository seems to be okay. is there a chance where we can connect on a call on and discuss, please let me know.

calebcartwright commented 3 years ago

is there a chance where we can connect on a call on and discuss, please let me know.

No, I don't see that being likely to happen, sorry.

The mirror task provided by this extension is an extremely lightweight wrapper that ultimately just runs a couple git invocations, and what you're experiencing right now is that the following git clone command is failing to clone the repository on your self-hosted Gitlab instance from your self-hosted agent:

git -c http.sslVerify=false clone --mirror http://****@nljz32srap008.imptobnet.com/aras/plm.git

The underlying issue is almost certainly related to the auth value you're utilizing or with elements in your setup (e.g. supported auth mechanisms on your Gitlab instance, git version on your pipeline agent, etc.), neither of which we could really assist with and both of which are well outside the scope of the open source support we're willing/able to provide for this extension.

You could try running that git command directly from your pipeline (presumably via a Command Line Script or inline PowerShell task since you are apparently on Windows), but I would expect the exact same behavior so long as the auth components are the same. I'm not terribly familiar with Gitlab, but I vaguely recall past reports of users having better luck utilizing a username:password value for the source auth after having issues with token usage, so you may want to try that as well:

i.e. image

sarang3614 commented 3 years ago

hi @calebcartwright , Appreciate all of the support extended and your valuable inputs. Let me check the supported auth settings on the gitlab and the other try out you mentioned, Thanks.

sarang3614 commented 3 years ago

I'm not terribly familiar with Gitlab, but I vaguely recall past reports of users having better luck utilizing a username:password value for the source auth after having issues with token usage, so you may want to try that as well:

hi @calebcartwright - the mentioned setting worked and believe the add-in is working as expected. I encountered another error while mirroring, however it is problem with my source repository size.

Thanks for your support.