1

We have a new project and we host it in our own Gitlab server. I cloned it from

git@git.myacme.com:webapplication/app.git

successfully.

Let's say my username in gitlab is scott@myacme.com.

We also have an existing project in Github and the username I'm using is scott@yahoo.com

On the new project, we have an entry in package.json that is pointing to the existing project. Take note of the https

https://github.com/myacme/system-application.git

Now, when I execute npm install, it fails when it tries to pull the existing project in github.com. It's saying Invalid Username or Password .... Authentication failed. I think it's still using scott@myacme.com rather than scott@yahoo.com

I'm not allowed to change package.json. I was thinking of changing it to a git link instead of https but I will affect other developers. If I do, I'm thinking that it will use the settings I put in .ssh/config. I added 2 hosts, our myacme.com and github.com

What is the workaround for this? I've tried setting git config global user.name and user.email using my yahoo email address but it's still not using it. I'm out of ideas.

Here is the exact error in npm-debug.log file

515 error git clone --template=/Users/scott/.npm/_git-remotes/_templates --mirror https://github.com/myacme/system-application.git /Users/scott/.npm/_git-remotes/https-github-com-myacme-system-application-git-0be15bdd: remote: Invalid username or password.

515 error git clone --template=/Users/scott/.npm/_git-remotes/_templates --mirror https://github.com/myacme/system-application.git /Users/scott/.npm/_git-remotes/https-github-com-myacme-system-application-git-0be15bdd: fatal: Authentication failed for 'https://github.com/myacme/system-application.git/'
devwannabe
  • 3,160
  • 8
  • 42
  • 79

1 Answers1

1

The user.name is not used for authentication with https, it is only used when making a commit (for author/committer name)

What you can do is:

That way, the git clone would use a known authentication on GitHub (your GitHub scott account, because it has the right ssh public key).

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • I should have mentioned that git clone is working fine. It's an npm issue – devwannabe Oct 09 '15 at 05:07
  • 1
    @devwannabe "it fails when it tries to pull the existing project in github.com." This will make it not fail. Without you having to change any url. – VonC Oct 09 '15 at 05:08
  • I decided to change it to a git link in package.json and I'll just inform my teammates tomorrow. I was running out of time. I'm good now – devwannabe Oct 09 '15 at 05:08
  • WOW, learned something new! That is cool! It worked! :) Thank you! – devwannabe Oct 09 '15 at 05:11