Piping output from Git Bash to clipboard

Well, actualy git branch | clip works fine for me. clip command just calls clip.exe from C:\Windows\System32\. Make sure you have clip.exe installed somewhere in your PATH.


copy thing.txt to clipboard

cat thing > /dev/clipboard

Put contents of clipboard into thing.txt

cat /dev/clipboard > thing.txt

I aliased these things to pbcopy and pbpaste so I feel like I'm on my mac.


@madhead's answer is correct - the PATH variable must be set from within git-bash. Here's an elaboration on how to fix this issue, courtesy of Cairnarvon's answer on superuser:

To check what PATH is currently set to:

> echo $PATH

And to set it, assuming a 64-bit architecture:

> export PATH="$PATH:/c/Windows/System32:/c/Windows/SysWOW64"

Result of git branch | clip:

* master
  dev
  dev_foo