0

I have two different github account, one personal and another of my company.

I am using SSH key for my work account which is set globally and username and password for my personal account which is set locally for particular repo.

I have no issue in pulling and pushing changes to either account. it works perfectly find.

however from my personal account when I am trying to deploy my code to github pages it tries to authenticate using wrong username (work account)

Following is the error.

Gaurang033 - Personal account

gaurang_work - Work account

▶ rm -rf node_modules/gh-pages/.cache; npm run deploy

> most-popular@0.1.0 predeploy /Users/gaurang.shah/gitRepo/popular-movies
> npm run build


> most-popular@0.1.0 build /Users/gaurang.shah/gitRepo/popular-movies
> react-scripts build

Creating an optimized production build...
Compiled successfully.

File sizes after gzip:

  56.16 KB  build/static/js/2.8360eafd.chunk.js
  1.94 KB   build/static/js/main.867a2b42.chunk.js
  785 B     build/static/js/runtime~main.d936f90a.js
  397 B     build/static/css/main.6f7911ff.chunk.css

The project was built assuming it is hosted at /Gaurang033/popular-movies/.
You can control this with the homepage field in your package.json.

The build folder is ready to be deployed.

Find out more about deployment here:


> most-popular@0.1.0 deploy /Users/gaurang.shah/gitRepo/popular-movies
> gh-pages -d build

remote: Permission to Gaurang033/popular-movies.git denied to gaurang_work.
fatal: unable to access 'https://github.com/Gaurang033/popular-movies.git/': The requested URL returned error: 403

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! most-popular@0.1.0 deploy: `gh-pages -d build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the most-popular@0.1.0 deploy script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/gaurang.shah/.npm/_logs/2019-10-17T15_41_17_131Z-debug.log

I could not use seperate SSH Config as HostName is same for both github.com

Gaurang Shah
  • 11,764
  • 9
  • 74
  • 137
  • 1
    Possible duplicate of [Multiple GitHub Accounts & SSH Config](https://stackoverflow.com/questions/3225862/multiple-github-accounts-ssh-config) – phd Oct 17 '19 at 17:22
  • https://stackoverflow.com/search?q=%5Bgithub%5D+multiple+accounts – phd Oct 17 '19 at 17:22
  • @phd i could not try that solution as in my case `hostname` for both is same `github.com` – Gaurang Shah Oct 18 '19 at 13:41
  • `Host` and `HostName` are 2 different parameters. You use 2 different `Host`s with the same `HostName`. Like in the accepted answer at the link. And you change remote URLs in git repositories according to the `Host`, not `HostName`. – phd Oct 18 '19 at 13:45

0 Answers0