DEV Community

Haruka Kato
Haruka Kato

Posted on

Permission to username/project.git denied to user

I was trying to push my new repository to my Github and the permission was denied because I was trying to push it to my old workplace's account.

But it took some time to find the right solution for me so I wanted to leave here.

If you attempt all these steps and your terminal says like this

remote: Permission to harukakato35/StressBox.git denied to ○○○.
fatal: unable to access 'https://github.com/harukakato35/StressBox.git/': The requested URL returned error: 403
Enter fullscreen mode Exit fullscreen mode

Try this as the quickest way.

git push git@github.com:harukakato35/StressBox.git main
Enter fullscreen mode Exit fullscreen mode

Or with this way, you can connect with the account you want

$ git remote set-url origin https://hoge@github.com/hoge/abc.git
$ git push origin main
Enter fullscreen mode Exit fullscreen mode

Hope this is useful for you!

Top comments (0)