4

I wanted to resync the tags on my local git repository with the ones on our remote server, using this answer provided on StackOverflow:

git tag -l | xargs git tag -d
git fetch --tags

I've got git for windows portable installed which includes xargs from FindUtils for Windows (as best I can tell).

When I run the first part of the command, all I get is:

xargs: git: No such file or directory

If I modify the command to run:

git tag -l | xargs echo

It correctly "echos" the tags for me. So, my only conclusion is that xargs for some reason can't resolve executables from the path.

How can I get xargs to properly execute what's passed to it (without resorting to passing the full path to git.exe?)

  • Did you ever resolve this issue? I'm seeing the same thing – itslittlejohn Nov 29 '17 at 14:46
  • Nope, never got to the bottom of it :-| – gerrod Nov 30 '17 at 6:22
  • Running the exact command in git bash worked fine, so I went with that. ¯_(ツ)_/¯ – itslittlejohn Nov 30 '17 at 16:38
1

I use the Gnu on Windows port of the Unix tools and get a similar problem to this but the error message is always Invalid argument, e.g.

> printf "Hello World!" | xargs printf "%s %s"
xargs: printf: Invalid argument

One solution appears to be to use the "proverbial" extra level of indirection, for example a shell such as cmd.exe, to actually invoke the command:

> printf "Hello World!" | xargs cmd /c printf "%s %s"
Hello World!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.