DEV Community

Kunguma Sakthivel K
Kunguma Sakthivel K

Posted on

Permission denied to push into remote repo!

Here I can't able to push my file into GitHub. I shows error
The requested URL returned error: 403 and permission denied in terminal(Attached Image below).

PS C:\Users\LENOVO\Desktop\ReactJS\portfolio> git add src/.   
PS C:\Users\LENOVO\Desktop\ReactJS\portfolio> git add public/.  
PS C:\Users\LENOVO\Desktop\ReactJS\portfolio> git commit -m "second Commit" 
On branch main
nothing to commit, working tree clean
PS C:\Users\LENOVO\Desktop\ReactJS\portfolio> git branch -M main
PS C:\Users\LENOVO\Desktop\ReactJS\portfolio> git remote add origin https://github.com/kungumasakthivel/Dumy.git
error: remote origin already exists.
PS C:\Users\LENOVO\Desktop\ReactJS\portfolio> git remote remove orgin
error: No such remote: 'orgin'
PS C:\Users\LENOVO\Desktop\ReactJS\portfolio> git remote remove orgine
error: No such remote: 'orgine'
PS C:\Users\LENOVO\Desktop\ReactJS\portfolio> git remote remove origin
PS C:\Users\LENOVO\Desktop\ReactJS\portfolio> git remote add origin https://github.com/kungumasakthivel/Dumy.git
PS C:\Users\LENOVO\Desktop\ReactJS\portfolio> git push -u origin main
remote: Permission to kungumasakthivel/Dumy.git denied to Agil1102.
fatal: unable to access 'https://github.com/kungumasakthivel/Dumy.git/': The requested URL returned error: 403
Enter fullscreen mode Exit fullscreen mode

github push error in terminal

__

Top comments (4)

Collapse
 
raddevus profile image
raddevus • Edited
  1. Go to your GitHub account and click your icon in the upper left corner

Image description

2.Choose the Settings menu option.
3.Page will load, now select the very last item on the bottom left (< > Developer Settings)

Image description

4.New page will load (very odd looking really) -- we want to choose "Personal access tokens"
It is likely you'll have to expand that item to see the two items beneath it.

Image description

5.Now, we want to select Tokens(classic)
You'll see something like the following:

Image description
6.We want to generate a new token:

Image description

7.Let's select Generate New token (classic)

You'll probably have to type in your GitHub password at this point to prove you are really you.

Now you'll see a huge list of items (scrolls of the page) for what you want to allow the PAT (personal access token) to be able to do.

You can add a note (to remind you what it is for), an expiration date and for the ability to update your repo code you want it to be like the following:

Image description

8.Scroll all the way tot he bottom of the page and click the [Generate Token] button

Image description

When you do that it will display the "password" one time and never again.

Image description

Copy that password and put it somewhere where only you can get to it.

Now, when you attempt to push changes to GitHub you will use it like the following:

$ git push
Username for ''https://github.com': <type your username> 
Password for 'https://yourUserName@github.com': <type the password from above here>
Enter fullscreen mode Exit fullscreen mode

That's how its really done.

NOTE : Yes, I deleted the PAT from my account so that password will no longer work. 🤓

Collapse
 
mellen profile image
Matt Ellen

Are you setup to push with ssh keys?

Collapse
 
kungumasakthivel profile image
Kunguma Sakthivel K

No I didn't use ssh key.

Collapse
 
mellen profile image
Matt Ellen

I don't think you can push to GitHub unless you are using SSH keys or using their CLI.

Try the GitHub CLI, as that might be able to solve your problem.