错误code128:npm ERR! An unknown git error occurred command git --no-replace-objects ls-remote ssh://

Table of contents

1. Encountering problems

2. Causes of problems 

3. Solution

4. Similar errors


1. Encountering problems

I encountered this problem when using the command npm install to download dependencies. Even if I switched to the domestic Taobao source, I could not download it.

npm ERR! code 128
npm ERR! An unknown git error occurred
npm ERR! command git --no-replace-objects ls-remote ssh://[email protected]/nhn/raphael.git
npm ERR! [email protected]: 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.

npm ERR! A complete log of this run can be found in:
npm ERR!     D:\IT_base\node16\node_cache\_logs\2023-09-16T05_03_02_827Z-debug-0.log

2. Causes of problems 

 There was a problem when pulling things on git

3. Solution

1. Execute this command in the project

git config --global url."https://".insteadOf ssh://git@

 The purpose of this command is to change Git's default URL protocol when cloning (or pulling) a repository using SSH from SSH to HTTPS. This is a Git configuration setting that can have an impact on your Git operations.

Normally, when you use the SSH protocol to clone or pull a Git repository, the format of the URL is ssh://[email protected]/username/repo.git, where [email protected]is the SSH URL. But sometimes, you may want to redirect Git operations to use the HTTPS protocol, for example https://github.com/username/repo.git, to avoid the setup and management of SSH keys.

After using git configthe command setting url."https://".insteadOf ssh://git@, Git will use the HTTPS protocol instead of the SSH protocol by default to access the remote repository to perform operations such as cloning and pulling. This is useful for situations where you don't want or need to use SSH keys.

Note that this configuration is a global configuration and will affect all Git repositories in your system. If you only want to use the HTTPS protocol in a specific repository, you can .git/configconfigure it in the repository's file instead of configuring it globally.

2. Execute the command to download dependencies

npm install

In this way, the dependencies are downloaded successfully.

 

4. Similar errors

Solve the problems encountered by npm install: Error while executing:_Cloud's Happy Cat's Blog-CSDN Blog

Guess you like

Origin blog.csdn.net/m0_52861000/article/details/132917423