Git fetch origin failed with exit code: 128

deployment failing with error

Test-LastExit : git fetch origin failed with exit code: 128

Hi @sarvishn,

Thanks for getting in touch!

Initial checks on the error suggest that this is related to an authentication failure against Git.

To be able to provide anything more detailed I would need more information around the scenario that is resulting in this error.
What version of Octopus are you using?
What kind of step or script is being run that results in this error?

A copy of the downloaded deployment task log would also be useful.

Regards,
Paul

Running octopus 3.10.13
recently have got same deployment succeful… but this one started failing suddently
Also we have bamboo CI integrated with octopus to do deployment

simple 07-Sep-2020 19:28:00 Build Deployment of ‘1.419’ on ‘TestISO for APIM’ started building on agent 10.10.4.146
simple 07-Sep-2020 19:28:00 Remote agent on host 10.10.4.146
simple 07-Sep-2020 19:28:00 Build working directory is C:\Bamboo-Home-1\xml-data\build-dir\30048260-44105744
simple 07-Sep-2020 19:28:00 Executing build Deployment of ‘1.419’ on ‘TestISO for APIM’
simple 07-Sep-2020 19:28:00 Starting task ‘Clean working directory task’ of type ‘com.atlassian.bamboo.plugins.bamboo-artifact-downloader-plugin:cleanWorkingDirectoryTask’
simple 07-Sep-2020 19:28:00 Cleaning working directory ‘C:\Bamboo-Home-1\xml-data\build-dir\30048260-44105744’
simple 07-Sep-2020 19:28:02 Finished task ‘Clean working directory task’ with result: Success
simple 07-Sep-2020 19:28:02 Starting task ‘Download release contents’ of type ‘com.atlassian.bamboo.plugins.bamboo-artifact-downloader-plugin:artifactdownloadertask’
simple 07-Sep-2020 19:28:02 Preparing to download plan result FEIN-APIMDEV-556 artifact: Non required shared artifact: [DEV-API-CAC.zip], pattern: [DEV-API-CAC.zip]
simple 07-Sep-2020 19:28:02 Artifact [DEV-API-CAC.zip] downloaded successfully in 95.45 ms to working directory
simple 07-Sep-2020 19:28:02 Finished task ‘Download release contents’ with result: Success
simple 07-Sep-2020 19:28:02 Starting task ‘Copy Artifact’ of type ‘com.atlassian.bamboo.plugins.scripttask:task.builder.script’
command 07-Sep-2020 19:28:02 Beginning to execute external process for build ‘Deployment of ‘1.419’ on ‘TestISO for APIM’’\n … running command line: \nC:\Bamboo-Home-1\temp\30048260-44105744-60981994-ScriptBuildTask-7722418929388077441.bat\n … in: C:\Bamboo-Home-1\xml-data\build-dir\30048260-44105744\n … using extra environment variables: \nbamboo_planRepository_1_branch=develop\nbamboo_BitbucketServiceAccountUserPassword=\nbamboo_NexusServiceAccountUserPassword=\nbamboo_capability_system_builder_command_cmd=C:\Windows\System32\nbamboo_deploy_project=APIM_Deployment\nbamboo_deploy_environment=TestISO for APIM\nbamboo_capability_system_builder_command_Windows_PowerShell=C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe\nbamboo_capability_system_builder_stellarity_powershell_PowerShell__32_bit_=\nbamboo_planRepository_1_branchDisplayName=develop\nbamboo_capability_system_builder_msbuild_MSBuild_v14_0__64bit_=C:\Program Files (x86)\MSBuild\14.0\bin\amd64\MSBuild.exe\nbamboo_capability_system_builder_command_devenv=C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\devenv.exe\nbamboo_resultsUrl=https://bamboo.farahexperiences.com/deploy/viewDeploymentResult.action?deploymentResultId=60981994\nbamboo_capability_system_builder_msbuild_MSBuild_v4_0__32bit_=C:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe\nbamboo_capability_system_builder_command_Git=C:\Program Files (x86)\Git\bin\git.exe\nbamboo_build_working_directory=C:\Bamboo-Home-1\xml-data\build-dir\30048260-44105744\nbamboo_capability_system_builder_command_Curl=C:\curl-7.55.1-win64-mingw\bin\curl.exe\nbamboo_planRepository_1_name=APIM_Develop1\nbamboo_capability_system_builder_node_Nodejs_Shared=F:\node-v10.15.3-win-x64\node.exe\nbamboo_shortPlanName=APIM_Build_Deploy\nbamboo_capability_system_builder_command_Nuget=C:\Program Files (x86)\NuGet\nuget.exe\nbamboo_planRepository_name=APIM_Develop1\nbamboo_buildNumber=556\nbamboo_deploy_release_previous=1.417\nbamboo_planRepository_repositoryUrl=ssh://git@bitbucket.farahexperiences.com:7990/fein/api-mgmt.git\nbamboo_capability_system_builder_devenv_Microsoft_VisualStudio_2015___Shared=C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\nbamboo_capability_system_builder_command_Octopus=C:\Users\Devopsadmin\Downloads\Octopus\oct.exe\nbamboo_capability_system_builder_command_Nuget_Shared=C:\Program Files (x86)\NuGet\nuget.exe\nbamboo_agentId=19791876\nbamboo_planName=FE-Infrastructure - APIM_Build_Deploy\nbamboo_shortPlanKey=APIMDEV\nbamboo_capability_system_builder_octopuscli_Octo_Shared=F:\OctopusTools.4.19.0\Octo.exe\nbamboo_planRepository_revision=13e66f55ecd7d9d08d0a42ae7e570bdb3f9bd28d\nbamboo_capability_system_builder_msbuild_Sonar_scanner_for_MSBuild_shared=C:\Bamboo Agent Executables\sonar-scanner-msbuild-3.0.0.629\nbamboo_capability_system_builder_testrunner_Ready_API_Prod_1=C:\Program Files\SmartBear\ReadyAPI-2.2.0\bin\nbamboo_capability_system_jdk_JDK_1_8_0_144=C:\Program Files\Java\jdk1.8.0_144\nbamboo_capability_system_builder_command_cmd_exe=c:\Windows\System32\cmd.exe\nbamboo_buildResultKey=FEIN-APIMDEV-556\nbamboo_capability_system_builder_testrunner_Soap_UI_Prod_1=C:\Program Files (x86)\SmartBear\SoapUI-5.3.0\bin\nbamboo_deploy_release=1.419\nbamboo_capability_system_builder_stellarity_powershell_PowerShell=\nbamboo_SonarHostURL=http://sonarqube.farahexperiences.com:8080/\nbamboo_planRepository_1_revision=13e66f55ecd7d9d08d0a42ae7e570bdb3f9bd28d\nbamboo_capability_system_builder_devenv_Microsoft_VisualStudio_2015_New=C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\nbamboo_capability_system_builder_octopuscli_Octo_Shared_147=F:\OctopusTools.4.22.1\Octo.exe\nbamboo_capability_system_builder_command_Curl_Shared=C:\curl-7.55.1-win64-mingw\bin\curl.exe\nbamboo_com_stellarity_PowerShellTask_LoadProfile=true\nbamboo_capability_system_builder_octopuscli_Octo=F:\OctopusTools.4.19.0\Octo.exe\nbamboo_capability_system_builder_mvn3_mvn=C:\Maven\apache-maven-3.5.0\nbamboo_planRepository_branch=develop\nbamboo_ServiceAccountUserPassword=\nbamboo_agentWorkingDirectory=C:\Bamboo-Home-1\xml-data\build-dir\nbamboo_capability_system_git_executable=C:\Program Files\Git\bin\git.exe\nbamboo_capability_system_builder_msbuild_sonar_scanner_msbuild_4=C:\sonar-scanner-msbuild-4.8.0\nbamboo_planRepository_branchDisplayName=develop\nbamboo_planRepository_1_type=bbserver\nbamboo_planRepository_branchName=develop\nbamboo_deploy_version_previous=1.417\nbamboo_capability_system_builder_msbuild_Sonar_for_MSBuild___Shared=C:\sonar-scanner-msbuild-3.0.0.629\nbamboo_SonarAuthKeyPassword=\nbamboo_capability_system_builder_stellarity_powershell_PowerShell__64_bit_=\nbamboo_capability_system_jdk_JDK=C:\Program Files\Java\jdk1.8.0_144\nbamboo_deploy_rollback=false\nbamboo_capability_system_builder_command_Powershell=C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe\nbamboo_hg_cache_directory=C:\Bamboo-Home-1\xml-data\build-dir_hg-repositories-cache\nbamboo_capability_system_builder_mvn3_Maven_Shared=C:\Maven\apache-maven-3.5.0\nbamboo_planRepository_1_username=\nbamboo_planRepository_type=bbserver\nbamboo_capability_system_builder_msbuild_MSBuild_v14_0__32bit_=C:\Program Files (x86)\MSBuild\14.0\bin\MSBuild.exe\nbamboo_git_cache_directory=C:\Bamboo-Home-1\xml-data\build-dir_git-repositories-cache\nbamboo_ManualBuildTriggerReason_userName=dnarwal\nbamboo_capability_system_builder_sor_Sonar_Runner_for_MSBuild___Shared=C:\sonar-scanner-msbuild-3.0.0.629\bin\sonar-scanner-3.0.3.778\nbamboo_SendGridAPIKeyPassword=********\nbamboo_capability_system_builder_msbuild_MSBuild_v4_0__64bit_=C:\Windows\Microsoft.NET\Framework64\v4.0.30319\MSBuild.exe\nbamboo_capability_system_builder_sos_sonar_scanner_SQL=F:\sonar-scanner-3.0.3.778-windows\bin\nbamboo_tmp_directory=C:\Bamboo-Home-1\temp\nbamboo_working_directory=C:\Bamboo-Home-1\xml-data\build-dir\30048260-44105744\nbamboo_planKey=FEIN-APIMDEV\nbamboo_capability_system_builder_sos_Sonar_Scanner=F:\sonar-scanner-3.0.3.778-windows\nbamboo_planRepository_1_repositoryUrl=ssh://git@bitbucket.farahexperiences.com:7990/fein/api-mgmt.git\nbamboo_capability_system_builder_command_Nuget_Shared_147=F:\nuget\nuget.exe\nbamboo_planRepository_username=\nbamboo_capability_system_jdk_JDK_1_8=C:\Program Files\Java\jdk1.8.0_144\nbamboo_capability_system_builder_command_CMD_Wget=C:\wget.exe\nbamboo_capability_system_builder_command_Powershell_shared=C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe\nbamboo_planRepository_1_branchName=develop\nbamboo_deploy_version=1.419\n
build 07-Sep-2020 19:28:02
build 07-Sep-2020 19:28:02 C:\Bamboo-Home-1\xml-data\build-dir\30048260-44105744>dir
build 07-Sep-2020 19:28:02 Volume in drive C has no label.
build 07-Sep-2020 19:28:02 Volume Serial Number is 10DF-697A
build 07-Sep-2020 19:28:02
build 07-Sep-2020 19:28:02 Directory of C:\Bamboo-Home-1\xml-data\build-dir\30048260-44105744
build 07-Sep-2020 19:28:02
build 07-Sep-2020 19:28:02 09/07/2020 07:28 PM .
build 07-Sep-2020 19:28:02 09/07/2020 07:28 PM …
build 07-Sep-2020 19:28:02 09/07/2020 07:28 PM 1,162,056 DEV-API-CAC.zip
build 07-Sep-2020 19:28:02 1 File(s) 1,162,056 bytes
build 07-Sep-2020 19:28:02 2 Dir(s) 24,913,838,080 bytes free
build 07-Sep-2020 19:28:02
build 07-Sep-2020 19:28:02 C:\Bamboo-Home-1\xml-data\build-dir\30048260-44105744>copy /y DEV-API-CAC.zip API-CAC.zip
build 07-Sep-2020 19:28:02 1 file(s) copied.
build 07-Sep-2020 19:28:02
build 07-Sep-2020 19:28:02 C:\Bamboo-Home-1\xml-data\build-dir\30048260-44105744>dir
build 07-Sep-2020 19:28:02 Volume in drive C has no label.
build 07-Sep-2020 19:28:02 Volume Serial Number is 10DF-697A
build 07-Sep-2020 19:28:02
build 07-Sep-2020 19:28:02 Directory of C:\Bamboo-Home-1\xml-data\build-dir\30048260-44105744

ET https://octopus.farahexperiences.com/api/tasks/ServerTasks-75035/details
build 07-Sep-2020 19:29:41 Failed: Step 3: Publish_to_APIM
build 07-Sep-2020 19:29:41 Fatal The step failed: Activity Publish_to_APIM on Octopus Tentacle failed
build 07-Sep-2020 19:29:41 with error ‘The remote script failed with exit code 1’.
build 07-Sep-2020 19:29:41 Failed: Octopus Tentacle
build 07-Sep-2020 19:29:41 Info Executing script on ‘Octopus Tentacle’
build 07-Sep-2020 19:29:41 Info GAC Version Location
build 07-Sep-2020 19:29:41 Info — ------- --------
build 07-Sep-2020 19:29:41 Info True v4.0.30319 C:\Windows\Microsoft.Net\assembly\GAC_64\System.Web
build 07-Sep-2020 19:29:41 \v4…
build 07-Sep-2020 19:29:41 Info Finding path to package step: Download Package
build 07-Sep-2020 19:29:41 Info Package was installed to: C:\package_downloads
build 07-Sep-2020 19:29:41 Info Repository will be cloned to: C:\Octopus\Applications\GitPush\TestI
build 07-Sep-2020 19:29:41 SO\Deploy_Config_APIM\Publish_to_APIM
build 07-Sep-2020 19:29:41 Info Reinitialized existing Git repository in C:/Octopus/Applications/Gi
build 07-Sep-2020 19:29:41 tPush/TestISO/Deploy_Config_APIM/Publish_to_APIM/.git/
build 07-Sep-2020 19:29:41 Info Fetching remote repository
build 07-Sep-2020 19:29:41 Error Test-LastExit : git fetch origin failed with exit code: 128
build 07-Sep-2020 19:29:41 Error At C:\Octopus\NewAgent\Work\20200907152931-768\Script.ps1:105
build 07-Sep-2020 19:29:41 char:1
build 07-Sep-2020 19:29:41 Error + Test-LastExit “git fetch origin”
build 07-Sep-2020 19:29:41 Error + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
build 07-Sep-2020 19:29:41 Error + CategoryInfo : NotSpecified: (:slight_smile: [Write-Error], WriteErrorExcep
build 07-Sep-2020 19:29:41 Error tion
build 07-Sep-2020 19:29:41 Error + FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteError
build 07-Sep-2020 19:29:41 Exceptio
build 07-Sep-2020 19:29:41 Error n,Test-LastExit
build 07-Sep-2020 19:29:41 Error
build 07-Sep-2020 19:29:41 Fatal The remote script failed with exit code 1
build 07-Sep-2020 19:29:41 Fatal Publish_to_APIM on Octopus Tentacle
build 07-Sep-2020 19:29:41 Canceled: Step 4: Update_Property
build 07-Sep-2020 19:29:41 Canceled: Step 5: Deploy
build 07-Sep-2020 19:29:41 Success: Apply retention policy on Tentacles
build 07-Sep-2020 19:29:41 Info Apply retention policies…
build 07-Sep-2020 19:29:41 Info Tentacle retention policy set to ‘keep all’
build 07-Sep-2020 19:29:41 GET https://octopus.farahexperiences.com/api/tasks/ServerTasks-75035
build 07-Sep-2020 19:29:41 Deploy Deploy_Config_APIM release 1.419 to TestISO: Failed, The deployment failed because one or more steps failed. Please see the deployment log for details.
build 07-Sep-2020 19:29:41 One or more deployment tasks failed.
build 07-Sep-2020 19:29:41 Exit code: -1
simple 07-Sep-2020 19:29:41 Failing task since return code of [F:\OctopusTools.4.19.0\Octo.exe create-release --server https://octopus.farahexperiences.com --apiKey API-…56ORS7O --project Deploy_Config_APIM --version 1.419 --deployto TestISO --debug --progress --waitfordeployment --deploymenttimeout=00:45:00 -vresource_group=fe-qai-apimgmt-apps-rg -vservice_name=fe-testiso-apimgmt-service -vpackage=APIM-API-CAC.Pak -venvironment=TestIso -vazure_account=AdminAccount --packageversion=556] was -1 while expected 0
simple 07-Sep-2020 19:29:41 Finished task ‘Create release - TESTISO’ with result: Failed
simple 07-Sep-2020 19:29:41 Finalising the build…
simple 07-Sep-2020 19:29:41 Stopping timer.
simple 07-Sep-2020 19:29:41 Build 30048260-44105744-60981994 completed.
simple 07-Sep-2020 19:29:41 Finished processing deployment result Deployment of ‘1.419’ on ‘TestISO for APIM’

Thanks for the additional information.

All signs do point to the error being returned by the Git repository. I would start by checking to see if there have been any permission changes that could prevent the target from accessing the repository.
It would also be a good idea to test this function manually on the target with the same credentials the deployment uses to see if you encounter the same problem.

Re-trying the previous successful deployment could also help determine if the issue is related to the specific build or the entire connection.

Yes… retired with previous successful deployment and getting same git error… I will try to git fetch on the server and see if it fails… meanwhile if you can help with the fix or workaround would be helpful

As the error is occurring outside of Octopus there isn’t really any workaround or fix that I can easily suggest. My feeling is that whatever method it is using to authenticate against the repository has been altered, either the API key or user permissions have been changed.

on octopus where we can validate that?

If you are using an external repository, then perhaps check Library > External Feeds.

Otherwise, check the Project > Process and the step that is failing (Step 3: Publish_to_APIM) to see if there are connection details entered in there.

Hi Paul,

was able to fix the issue… you were right the git authentication was failing for the Azure APIM service due to some issue at their end which they fixed later and deployment got succeeded…

Thanks for your quick support!

1 Like

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.