Im working from a mac and trying to create an ssh key for my git but every time I type pb copy < ~/ssh
to copy the file, i get this message:
*** Terminating app due to uncaught exception 'NSFileHandleOperationException', reason: '*** -[_NSStdIOFileHandle readDataOfLength:]: Is a directory'
*** First throw call stack:
(
0 CoreFoundation 0x00007fff33310f3b __exceptionPreprocess + 171
1 libobjc.A.dylib 0x00007fff5a6b9942 objc_exception_throw + 48
2 CoreFoundation 0x00007fff333a12d5 +[NSException raise:format:] + 197
3 Foundation 0x00007fff3543e10d -[NSConcreteFileHandle readDataOfLength:] + 489
4 pbcopy 0x00000001021dcac4 pbcopy + 6852
5 libdyld.dylib 0x00007fff5b2d4015 start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
Abort trap: 6
i have no idea what im doing wrong. any help? i'd rly appreciate it
I re-did the steps to generate a new key. I have the .pub file and i can locate it in bash using ls ~/ .ssh/ but when trying to copy it is where the issues begin
The error you're encountering with
pbcopy
on macOS is related to a file handling exception. This issue typically occurs when the command is trying to access a directory instead of a file, which is not the intended use ofpbcopy
. The commandpbcopy
is designed to copy text data to the clipboard and expects either direct input or a file containing text data.Looks like you did try to copy directory instead of file inside that ~/.ssh directory.
Ensure that you are using
pbcopy
correctly. typical usage is to pipe the output of a command or a file intopbcopy
, like so:or