Repository navigation
"sshKeyMemoryNew" is not found in Typescript #1962
Description
Activity
I'm having a different problem. Typescript does have
NodeGit.Cred.sshKeyMemoryNewfor me but noNodeGit.Credential. Trying to useNodeGit.Cred.sshKeyMemoryNewdoesn't work in Node 14 or 16 when using"nodegit": "^0.28.0-alpha.21"and"@types/nodegit": "^0.28.2". If I change tosshKeyNewI get the same deprecation warning, but it works. I've been trying different builds of nodegit 0.28.0 alphas for a while and have yet to find one that works onsskKeyMemoryNew. The same code does work in"nodegit": "^0.27.0"Trying to use
NodeGit.Cred.sshKeyMemoryNewsimply throws the errorMethod clone has thrown an error.with no additional info (or fetch or other calls). Trying to call it directly looks like it's been removed.import { Cred } from "nodegit"; const credentials = await Cred.sshKeyMemoryNew("git", deployKeyPublic, deployKeyPrivate, ""); throws: TypeError: nodegit_1.Cred.sshKeyMemoryNew is not a functionSo it looks like
sshKeyMemoryNewhas been removed from the new version but is still in the typings and docs. Looking at https://github.com/nodegit/nodegit/blob/master/lib/credential.js seems to concur.Edit: More digging, it looks like the deprecated
Creddoesn't havesshKeyMemoryNewbutCredentialdoes.{ "typeof NodeGit.Cred": "object", "typeof NodeGit.Credential": "function", "Object.keys(NodeGit.Cred)": [ "defaultNew", "sshKeyFromAgent", "sshKeyNew", "usernameNew", "userpassPlaintextNew", "TYPE" ], "Object.keys(NodeGit.Credential)": [ "defaultNew", "sshKeyFromAgent", "sshKeyMemoryNew", "sshKeyNew", "usernameNew", "userpassPlaintextNew", "getSelfFreeingInstanceCount", "getNonSelfFreeingConstructedCount", "TYPE" ] }So there's two bugs. One is here in nodegit that
sshKeyMemoryNewis missing from credential.js. The second is in DefinitelyTyped that it's missing NodeGit.Credential.- added a commit that references this issue
on Mar 3, 2023 - added a commit that references this issue
on Mar 3, 2023 @tkmcmaster I agree with you. When I was looking inside, it seemed that the namespace of the js library had been changed, but Typescript did not support it. (I used "@types/nodegit": "^0.28.2")
Thanks for the update!! After updating to ^0.28.3 and rewriting to Credential, it worked! !- added a commit that references this issue
on Nov 27, 2025
Probably because namespace "Cred" has changed, "sshKeyMemoryNew" is not found in Typescript.
"sshKeyNew" can be used although the following warning is issued.
I think it will probably be solved by updating the definition of Typescript.
(It worked when I directly modified the output js file)
The definition may not have been updated because it is alpha, but it is necessary for check, so please support it.
System information