npm install private Gitlab Repo Permission Denied (publickey) in Powershell
up vote
2
down vote
favorite
I try to install a private gitlab repository via npm to another node project. The command is npm install --save gitlab:my-project#master
This fails with
npm ERR! Permission denied (publickey).
npm ERR! fatal: Could not read from remote repository.
npm ERR!
npm ERR! Please make sure you have the correct access rights
npm ERR! and the repository exists.
I have the following set up: Windows 10, git and Powershell.
Using git commands directly in Powershell is working fine, e.g. git pull asks for the password of my private key and it works. All the other git stuff is working fine except for the npm install command, which seems to use git internally.
If I use the git bash, that is installed with git on Windows, I can run the npm command and install the private repository. It only fails within Powershell.
Nevertheless one could say: use git bash, but I'm somehow used to the PowerShell. :)
windows ssh permissions powershell git
add a comment |
up vote
2
down vote
favorite
I try to install a private gitlab repository via npm to another node project. The command is npm install --save gitlab:my-project#master
This fails with
npm ERR! Permission denied (publickey).
npm ERR! fatal: Could not read from remote repository.
npm ERR!
npm ERR! Please make sure you have the correct access rights
npm ERR! and the repository exists.
I have the following set up: Windows 10, git and Powershell.
Using git commands directly in Powershell is working fine, e.g. git pull asks for the password of my private key and it works. All the other git stuff is working fine except for the npm install command, which seems to use git internally.
If I use the git bash, that is installed with git on Windows, I can run the npm command and install the private repository. It only fails within Powershell.
Nevertheless one could say: use git bash, but I'm somehow used to the PowerShell. :)
windows ssh permissions powershell git
I suspect you need new keys
– EBGreen
Mar 22 at 14:02
I'm not sure about this: the keys are working if I usegitcommands directly in Powershell. And in the git bash (which is installed during the git installation on Windows) even thenpmstuff works. I rather think that the process executed bynpmis not allowed to read the private key / doesn't even know there is any.
– Philipp
Mar 23 at 6:29
add a comment |
up vote
2
down vote
favorite
up vote
2
down vote
favorite
I try to install a private gitlab repository via npm to another node project. The command is npm install --save gitlab:my-project#master
This fails with
npm ERR! Permission denied (publickey).
npm ERR! fatal: Could not read from remote repository.
npm ERR!
npm ERR! Please make sure you have the correct access rights
npm ERR! and the repository exists.
I have the following set up: Windows 10, git and Powershell.
Using git commands directly in Powershell is working fine, e.g. git pull asks for the password of my private key and it works. All the other git stuff is working fine except for the npm install command, which seems to use git internally.
If I use the git bash, that is installed with git on Windows, I can run the npm command and install the private repository. It only fails within Powershell.
Nevertheless one could say: use git bash, but I'm somehow used to the PowerShell. :)
windows ssh permissions powershell git
I try to install a private gitlab repository via npm to another node project. The command is npm install --save gitlab:my-project#master
This fails with
npm ERR! Permission denied (publickey).
npm ERR! fatal: Could not read from remote repository.
npm ERR!
npm ERR! Please make sure you have the correct access rights
npm ERR! and the repository exists.
I have the following set up: Windows 10, git and Powershell.
Using git commands directly in Powershell is working fine, e.g. git pull asks for the password of my private key and it works. All the other git stuff is working fine except for the npm install command, which seems to use git internally.
If I use the git bash, that is installed with git on Windows, I can run the npm command and install the private repository. It only fails within Powershell.
Nevertheless one could say: use git bash, but I'm somehow used to the PowerShell. :)
windows ssh permissions powershell git
windows ssh permissions powershell git
asked Mar 22 at 13:56
Philipp
1112
1112
I suspect you need new keys
– EBGreen
Mar 22 at 14:02
I'm not sure about this: the keys are working if I usegitcommands directly in Powershell. And in the git bash (which is installed during the git installation on Windows) even thenpmstuff works. I rather think that the process executed bynpmis not allowed to read the private key / doesn't even know there is any.
– Philipp
Mar 23 at 6:29
add a comment |
I suspect you need new keys
– EBGreen
Mar 22 at 14:02
I'm not sure about this: the keys are working if I usegitcommands directly in Powershell. And in the git bash (which is installed during the git installation on Windows) even thenpmstuff works. I rather think that the process executed bynpmis not allowed to read the private key / doesn't even know there is any.
– Philipp
Mar 23 at 6:29
I suspect you need new keys
– EBGreen
Mar 22 at 14:02
I suspect you need new keys
– EBGreen
Mar 22 at 14:02
I'm not sure about this: the keys are working if I use
git commands directly in Powershell. And in the git bash (which is installed during the git installation on Windows) even the npm stuff works. I rather think that the process executed by npm is not allowed to read the private key / doesn't even know there is any.– Philipp
Mar 23 at 6:29
I'm not sure about this: the keys are working if I use
git commands directly in Powershell. And in the git bash (which is installed during the git installation on Windows) even the npm stuff works. I rather think that the process executed by npm is not allowed to read the private key / doesn't even know there is any.– Philipp
Mar 23 at 6:29
add a comment |
2 Answers
2
active
oldest
votes
up vote
1
down vote
Permission denied (publickey).
This means that your current public key cannot be authenticated by the remote server.
Check access via SSH
Run:
ssh -T git@gitlab.com
to see whether you're authenticated with gitlab.com correctly. Otherwise, make sure you've added your publickey to your GitLab account.
Use git+ssh://
Use git+ssh://, instead of git://, for example:
npm i -S git+ssh://git@gitlab.com/my-project/repo.git
See: Install npm module from GitLab private repository.
Provide different identity via SSH
To list your current identities, run:
ssh-add
ssh-add -L
To add different identity, run: ssh-add ~/.ssh/MyOtherKey.pem
Check npm
Also, make sure that you are not using any proxy for your npm. Check the config by npm config list.
Use npm Enterprise
You can use npm Enterprise to connect to your existing authentication system, such as OAuth2 (for GitLab), GitHub Enterprise and other. You can also check for existing auth-plugin (for GitLab, see: npme-auth-gitlab), or write one for custom authentication.
Use personal token
As for workaround, you can create your personal or OAuth2 access token (GitLab/OAuth2; GitHub/OAuth) and use it along with your private repository URL. OAuth token will allow you to access repo via API, and personal token directly via URL, e.g.
- GitHub:
https://PERSONAL_ACCESS_TOKEN@github.com/my-project/repo
- GitLab:
https://gitlab.com/my-project/repo?private_token=<PERSONAL_ACCESS_TOKEN>
No proxy configured in npm. I can't runssh-addnorsshin powershell. Both are not recognized (probably missing in WindowsPATH). If I want to execute thessh-add.exe, which is installed in/git/usr/binI first have to start the ssh agent (on Linux I'm usingeval $(ssh-agent -s)for this). Nevertheless: even if I start and add the identity to the ssh agent (I'll try later; don't want to break something now). Why does it work if I use the git command in Powershell?!
– Philipp
Mar 23 at 6:27
Git could have some configuration in.gitconfig, fornpmyou need to specify the identity separately.
– kenorb
Mar 23 at 11:06
@Philipp I'd recommend you to clone private repository with your personal token, I've added another section. I haven't tested it, so not sure if URL is correct, please let me know.
– kenorb
Mar 23 at 11:21
@Philipp Try also usinggit+ssh://instead ofgit://.
– kenorb
Mar 23 at 11:36
add a comment |
up vote
0
down vote
I had the same problem. This is how I solved it / my workaround:
- Make sure that you can authenticate against GitHub:
ssh -T git@gitlab.com
- Make sure
OpenSSH Authentication Serviceis not disabled (set it to manual start) - not sure if this step is necessary
- Now the most important step: remove the password protection from your
id_rsakey.npm installcan't handle password protected ssh keys.
I would recommend adding a read only SSH key directly to the repository you like to install. This makes having a SSH key without password protection a little bit less dangerous.
Add a config file into ~/.ssh/ in which you define your keys:
IdentityFile ~/.ssh/id_rsa
IdentityFile ~/.ssh/repository_ssh_key
add a comment |
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
1
down vote
Permission denied (publickey).
This means that your current public key cannot be authenticated by the remote server.
Check access via SSH
Run:
ssh -T git@gitlab.com
to see whether you're authenticated with gitlab.com correctly. Otherwise, make sure you've added your publickey to your GitLab account.
Use git+ssh://
Use git+ssh://, instead of git://, for example:
npm i -S git+ssh://git@gitlab.com/my-project/repo.git
See: Install npm module from GitLab private repository.
Provide different identity via SSH
To list your current identities, run:
ssh-add
ssh-add -L
To add different identity, run: ssh-add ~/.ssh/MyOtherKey.pem
Check npm
Also, make sure that you are not using any proxy for your npm. Check the config by npm config list.
Use npm Enterprise
You can use npm Enterprise to connect to your existing authentication system, such as OAuth2 (for GitLab), GitHub Enterprise and other. You can also check for existing auth-plugin (for GitLab, see: npme-auth-gitlab), or write one for custom authentication.
Use personal token
As for workaround, you can create your personal or OAuth2 access token (GitLab/OAuth2; GitHub/OAuth) and use it along with your private repository URL. OAuth token will allow you to access repo via API, and personal token directly via URL, e.g.
- GitHub:
https://PERSONAL_ACCESS_TOKEN@github.com/my-project/repo
- GitLab:
https://gitlab.com/my-project/repo?private_token=<PERSONAL_ACCESS_TOKEN>
No proxy configured in npm. I can't runssh-addnorsshin powershell. Both are not recognized (probably missing in WindowsPATH). If I want to execute thessh-add.exe, which is installed in/git/usr/binI first have to start the ssh agent (on Linux I'm usingeval $(ssh-agent -s)for this). Nevertheless: even if I start and add the identity to the ssh agent (I'll try later; don't want to break something now). Why does it work if I use the git command in Powershell?!
– Philipp
Mar 23 at 6:27
Git could have some configuration in.gitconfig, fornpmyou need to specify the identity separately.
– kenorb
Mar 23 at 11:06
@Philipp I'd recommend you to clone private repository with your personal token, I've added another section. I haven't tested it, so not sure if URL is correct, please let me know.
– kenorb
Mar 23 at 11:21
@Philipp Try also usinggit+ssh://instead ofgit://.
– kenorb
Mar 23 at 11:36
add a comment |
up vote
1
down vote
Permission denied (publickey).
This means that your current public key cannot be authenticated by the remote server.
Check access via SSH
Run:
ssh -T git@gitlab.com
to see whether you're authenticated with gitlab.com correctly. Otherwise, make sure you've added your publickey to your GitLab account.
Use git+ssh://
Use git+ssh://, instead of git://, for example:
npm i -S git+ssh://git@gitlab.com/my-project/repo.git
See: Install npm module from GitLab private repository.
Provide different identity via SSH
To list your current identities, run:
ssh-add
ssh-add -L
To add different identity, run: ssh-add ~/.ssh/MyOtherKey.pem
Check npm
Also, make sure that you are not using any proxy for your npm. Check the config by npm config list.
Use npm Enterprise
You can use npm Enterprise to connect to your existing authentication system, such as OAuth2 (for GitLab), GitHub Enterprise and other. You can also check for existing auth-plugin (for GitLab, see: npme-auth-gitlab), or write one for custom authentication.
Use personal token
As for workaround, you can create your personal or OAuth2 access token (GitLab/OAuth2; GitHub/OAuth) and use it along with your private repository URL. OAuth token will allow you to access repo via API, and personal token directly via URL, e.g.
- GitHub:
https://PERSONAL_ACCESS_TOKEN@github.com/my-project/repo
- GitLab:
https://gitlab.com/my-project/repo?private_token=<PERSONAL_ACCESS_TOKEN>
No proxy configured in npm. I can't runssh-addnorsshin powershell. Both are not recognized (probably missing in WindowsPATH). If I want to execute thessh-add.exe, which is installed in/git/usr/binI first have to start the ssh agent (on Linux I'm usingeval $(ssh-agent -s)for this). Nevertheless: even if I start and add the identity to the ssh agent (I'll try later; don't want to break something now). Why does it work if I use the git command in Powershell?!
– Philipp
Mar 23 at 6:27
Git could have some configuration in.gitconfig, fornpmyou need to specify the identity separately.
– kenorb
Mar 23 at 11:06
@Philipp I'd recommend you to clone private repository with your personal token, I've added another section. I haven't tested it, so not sure if URL is correct, please let me know.
– kenorb
Mar 23 at 11:21
@Philipp Try also usinggit+ssh://instead ofgit://.
– kenorb
Mar 23 at 11:36
add a comment |
up vote
1
down vote
up vote
1
down vote
Permission denied (publickey).
This means that your current public key cannot be authenticated by the remote server.
Check access via SSH
Run:
ssh -T git@gitlab.com
to see whether you're authenticated with gitlab.com correctly. Otherwise, make sure you've added your publickey to your GitLab account.
Use git+ssh://
Use git+ssh://, instead of git://, for example:
npm i -S git+ssh://git@gitlab.com/my-project/repo.git
See: Install npm module from GitLab private repository.
Provide different identity via SSH
To list your current identities, run:
ssh-add
ssh-add -L
To add different identity, run: ssh-add ~/.ssh/MyOtherKey.pem
Check npm
Also, make sure that you are not using any proxy for your npm. Check the config by npm config list.
Use npm Enterprise
You can use npm Enterprise to connect to your existing authentication system, such as OAuth2 (for GitLab), GitHub Enterprise and other. You can also check for existing auth-plugin (for GitLab, see: npme-auth-gitlab), or write one for custom authentication.
Use personal token
As for workaround, you can create your personal or OAuth2 access token (GitLab/OAuth2; GitHub/OAuth) and use it along with your private repository URL. OAuth token will allow you to access repo via API, and personal token directly via URL, e.g.
- GitHub:
https://PERSONAL_ACCESS_TOKEN@github.com/my-project/repo
- GitLab:
https://gitlab.com/my-project/repo?private_token=<PERSONAL_ACCESS_TOKEN>
Permission denied (publickey).
This means that your current public key cannot be authenticated by the remote server.
Check access via SSH
Run:
ssh -T git@gitlab.com
to see whether you're authenticated with gitlab.com correctly. Otherwise, make sure you've added your publickey to your GitLab account.
Use git+ssh://
Use git+ssh://, instead of git://, for example:
npm i -S git+ssh://git@gitlab.com/my-project/repo.git
See: Install npm module from GitLab private repository.
Provide different identity via SSH
To list your current identities, run:
ssh-add
ssh-add -L
To add different identity, run: ssh-add ~/.ssh/MyOtherKey.pem
Check npm
Also, make sure that you are not using any proxy for your npm. Check the config by npm config list.
Use npm Enterprise
You can use npm Enterprise to connect to your existing authentication system, such as OAuth2 (for GitLab), GitHub Enterprise and other. You can also check for existing auth-plugin (for GitLab, see: npme-auth-gitlab), or write one for custom authentication.
Use personal token
As for workaround, you can create your personal or OAuth2 access token (GitLab/OAuth2; GitHub/OAuth) and use it along with your private repository URL. OAuth token will allow you to access repo via API, and personal token directly via URL, e.g.
- GitHub:
https://PERSONAL_ACCESS_TOKEN@github.com/my-project/repo
- GitLab:
https://gitlab.com/my-project/repo?private_token=<PERSONAL_ACCESS_TOKEN>
edited Mar 23 at 11:32
answered Mar 22 at 14:12
kenorb
10.5k1576109
10.5k1576109
No proxy configured in npm. I can't runssh-addnorsshin powershell. Both are not recognized (probably missing in WindowsPATH). If I want to execute thessh-add.exe, which is installed in/git/usr/binI first have to start the ssh agent (on Linux I'm usingeval $(ssh-agent -s)for this). Nevertheless: even if I start and add the identity to the ssh agent (I'll try later; don't want to break something now). Why does it work if I use the git command in Powershell?!
– Philipp
Mar 23 at 6:27
Git could have some configuration in.gitconfig, fornpmyou need to specify the identity separately.
– kenorb
Mar 23 at 11:06
@Philipp I'd recommend you to clone private repository with your personal token, I've added another section. I haven't tested it, so not sure if URL is correct, please let me know.
– kenorb
Mar 23 at 11:21
@Philipp Try also usinggit+ssh://instead ofgit://.
– kenorb
Mar 23 at 11:36
add a comment |
No proxy configured in npm. I can't runssh-addnorsshin powershell. Both are not recognized (probably missing in WindowsPATH). If I want to execute thessh-add.exe, which is installed in/git/usr/binI first have to start the ssh agent (on Linux I'm usingeval $(ssh-agent -s)for this). Nevertheless: even if I start and add the identity to the ssh agent (I'll try later; don't want to break something now). Why does it work if I use the git command in Powershell?!
– Philipp
Mar 23 at 6:27
Git could have some configuration in.gitconfig, fornpmyou need to specify the identity separately.
– kenorb
Mar 23 at 11:06
@Philipp I'd recommend you to clone private repository with your personal token, I've added another section. I haven't tested it, so not sure if URL is correct, please let me know.
– kenorb
Mar 23 at 11:21
@Philipp Try also usinggit+ssh://instead ofgit://.
– kenorb
Mar 23 at 11:36
No proxy configured in npm. I can't run
ssh-add nor ssh in powershell. Both are not recognized (probably missing in Windows PATH). If I want to execute the ssh-add.exe, which is installed in /git/usr/bin I first have to start the ssh agent (on Linux I'm using eval $(ssh-agent -s) for this). Nevertheless: even if I start and add the identity to the ssh agent (I'll try later; don't want to break something now). Why does it work if I use the git command in Powershell?!– Philipp
Mar 23 at 6:27
No proxy configured in npm. I can't run
ssh-add nor ssh in powershell. Both are not recognized (probably missing in Windows PATH). If I want to execute the ssh-add.exe, which is installed in /git/usr/bin I first have to start the ssh agent (on Linux I'm using eval $(ssh-agent -s) for this). Nevertheless: even if I start and add the identity to the ssh agent (I'll try later; don't want to break something now). Why does it work if I use the git command in Powershell?!– Philipp
Mar 23 at 6:27
Git could have some configuration in
.gitconfig, for npm you need to specify the identity separately.– kenorb
Mar 23 at 11:06
Git could have some configuration in
.gitconfig, for npm you need to specify the identity separately.– kenorb
Mar 23 at 11:06
@Philipp I'd recommend you to clone private repository with your personal token, I've added another section. I haven't tested it, so not sure if URL is correct, please let me know.
– kenorb
Mar 23 at 11:21
@Philipp I'd recommend you to clone private repository with your personal token, I've added another section. I haven't tested it, so not sure if URL is correct, please let me know.
– kenorb
Mar 23 at 11:21
@Philipp Try also using
git+ssh:// instead of git://.– kenorb
Mar 23 at 11:36
@Philipp Try also using
git+ssh:// instead of git://.– kenorb
Mar 23 at 11:36
add a comment |
up vote
0
down vote
I had the same problem. This is how I solved it / my workaround:
- Make sure that you can authenticate against GitHub:
ssh -T git@gitlab.com
- Make sure
OpenSSH Authentication Serviceis not disabled (set it to manual start) - not sure if this step is necessary
- Now the most important step: remove the password protection from your
id_rsakey.npm installcan't handle password protected ssh keys.
I would recommend adding a read only SSH key directly to the repository you like to install. This makes having a SSH key without password protection a little bit less dangerous.
Add a config file into ~/.ssh/ in which you define your keys:
IdentityFile ~/.ssh/id_rsa
IdentityFile ~/.ssh/repository_ssh_key
add a comment |
up vote
0
down vote
I had the same problem. This is how I solved it / my workaround:
- Make sure that you can authenticate against GitHub:
ssh -T git@gitlab.com
- Make sure
OpenSSH Authentication Serviceis not disabled (set it to manual start) - not sure if this step is necessary
- Now the most important step: remove the password protection from your
id_rsakey.npm installcan't handle password protected ssh keys.
I would recommend adding a read only SSH key directly to the repository you like to install. This makes having a SSH key without password protection a little bit less dangerous.
Add a config file into ~/.ssh/ in which you define your keys:
IdentityFile ~/.ssh/id_rsa
IdentityFile ~/.ssh/repository_ssh_key
add a comment |
up vote
0
down vote
up vote
0
down vote
I had the same problem. This is how I solved it / my workaround:
- Make sure that you can authenticate against GitHub:
ssh -T git@gitlab.com
- Make sure
OpenSSH Authentication Serviceis not disabled (set it to manual start) - not sure if this step is necessary
- Now the most important step: remove the password protection from your
id_rsakey.npm installcan't handle password protected ssh keys.
I would recommend adding a read only SSH key directly to the repository you like to install. This makes having a SSH key without password protection a little bit less dangerous.
Add a config file into ~/.ssh/ in which you define your keys:
IdentityFile ~/.ssh/id_rsa
IdentityFile ~/.ssh/repository_ssh_key
I had the same problem. This is how I solved it / my workaround:
- Make sure that you can authenticate against GitHub:
ssh -T git@gitlab.com
- Make sure
OpenSSH Authentication Serviceis not disabled (set it to manual start) - not sure if this step is necessary
- Now the most important step: remove the password protection from your
id_rsakey.npm installcan't handle password protected ssh keys.
I would recommend adding a read only SSH key directly to the repository you like to install. This makes having a SSH key without password protection a little bit less dangerous.
Add a config file into ~/.ssh/ in which you define your keys:
IdentityFile ~/.ssh/id_rsa
IdentityFile ~/.ssh/repository_ssh_key
edited Nov 27 at 17:16
answered Nov 27 at 16:58
jwillmer
1046
1046
add a comment |
add a comment |
Thanks for contributing an answer to Super User!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1306824%2fnpm-install-private-gitlab-repo-permission-denied-publickey-in-powershell%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
I suspect you need new keys
– EBGreen
Mar 22 at 14:02
I'm not sure about this: the keys are working if I use
gitcommands directly in Powershell. And in the git bash (which is installed during the git installation on Windows) even thenpmstuff works. I rather think that the process executed bynpmis not allowed to read the private key / doesn't even know there is any.– Philipp
Mar 23 at 6:29