diff --git a/meta-arm/recipes-security/trusted-services/ts-newlib_4.1.0.bb b/meta-arm/recipes-security/trusted-services/ts-newlib_4.1.0.bb
index 866276b3..1fda415a 100644
--- a/meta-arm/recipes-security/trusted-services/ts-newlib_4.1.0.bb
+++ b/meta-arm/recipes-security/trusted-services/ts-newlib_4.1.0.bb
@@ -25,7 +25,13 @@ export NEWLIB_CFLAGS_TARGET = "-Wno-implicit-function-declaration -Wno-int-conve
 
 # TS ships a patch that needs to be applied to newlib
 apply_ts_patch() {
-    ( cd ${WORKDIR}/git/newlib;    git stash; git branch -f bf_am; git am ${S}/external/newlib/*.patch; git reset bf_am )
+    set -ex
+    cd ${WORKDIR}/git/newlib
+    check_git_config
+    git stash
+    git branch -f bf_am
+    git am ${S}/external/newlib/*.patch
+    git reset bf_am
 }
 do_patch[postfuncs] += "apply_ts_patch"
 
