You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am using Ansible 2.8.1 with latest win_git module targeting a Windows 10 Pro 1903 machine running Git for Windows 2.16.2. Updating an existing git clone fails, see below. Initial cloning fails with a similar issue.
TASK [win_git] ************************************************************************************
task path: ansible-win_git.yaml:10
Using module file library/win_git.ps1
Pipelining is enabled.
<192.168.xx.xx> ESTABLISH WINRM CONNECTION FOR USER: user on PORT 5986 TO 192.168.xx.xx
EXEC (via pipeline wrapper)
fatal: [win10pro]: FAILED! => {
"changed": false,
"cmd_msg": null,
"msg": "Error cloning https://github.com/tivrobo/ansible-win_git.git to C:\\ansible-win_git! Msg: Already on 'master' - ",
"win_git": {
"accept_hostkey": true,
"branch": "master",
"clone": false,
"dest": "C:\\ansible-win_git",
"git_opts": "--no-pager pull origin master",
"method": "pull",
"recursive": true,
"replace_dest": false,
"repo": "https://github.com/tivrobo/ansible-win_git.git",
"update": true,
"valid_url": "https://github.com/tivrobo/ansible-win_git.git is valid url"
}
}
I recognized that this is caused by git generating a NativeCommandError exception when being executing in Powershell:
PS C:\ansible-win_git> git --no-pager checkout master
Your branch is up to date with 'origin/master'.
git : Already on 'master'
At line:1 char:1
+ git --no-pager checkout master
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (Already on 'master':String) [], RemoteException
+ FullyQualifiedErrorId : NativeCommandError
As a work around I added the following into win_git.ps1:
$env:GIT_REDIRECT_STDERR = '2>&1'
This changes the behavior of git in Powershell to the following:
PS C:\ansible-win_git> $env:GIT_REDIRECT_STDERR = '2>&1'
PS C:\ansible-win_git> git --no-pager checkout master
Your branch is up to date with 'origin/master'.
Already on 'master'
No exception is thrown anymore. The drawback is all stderr is merged into stdout.
The text was updated successfully, but these errors were encountered:
I am using Ansible 2.8.1 with latest win_git module targeting a Windows 10 Pro 1903 machine running Git for Windows 2.16.2. Updating an existing git clone fails, see below. Initial cloning fails with a similar issue.
I recognized that this is caused by git generating a
NativeCommandError
exception when being executing in Powershell:As a work around I added the following into
win_git.ps1
:This changes the behavior of git in Powershell to the following:
No exception is thrown anymore. The drawback is all stderr is merged into stdout.
The text was updated successfully, but these errors were encountered: