Is there a way to specify which ssh key should be used for npm install

后端 未结 3 1971
执笔经年
执笔经年 2020-12-23 14:49

I have a private repo that I want to install in my package.json file.

\"private-module\": \"git+ssh://git@bitbucket.org:private/private-module.git\"
<         


        
3条回答
  •  醉话见心
    2020-12-23 15:05

    Here are a few solutions:

    • Add an entry to your ~/.ssh/config. For example:

      Host bitbucket.org
           IdentityFile ~/.ssh/bitbucket_key
           IdentitiesOnly yes
      
    • Use ssh-agent and add your key to the agent instance beforehand.

    • Use something like ssh-ident for choosing ssh agents and identities dynamically based on the current working directory or arguments passed to ssh-ident. As their readme states, you would typically alias ssh-ident to ssh so that it's automatically used everywhere.

提交回复
热议问题