Search code examples
gitbashmacosclipboardpbcopy

Is it possible to copy remote origin url to clipboard using Bash on Mac (Darwin 17)?


I've tried one command line: pbcopy < git remote get-url origin

And other way: output.txt < git remote get-url origin

But I get next message:

-bash: git: No such file or directory

Any ways?

P.S. Git version: 2.13.3, OS Version: macOS High Sierra (Darwin 17).


Solution

  • If you want to redirect output to file output.txt it would be: git remote get-url origin > output.txt

    For clipboard do: git remote get-url origin | pbcopy