0

I have cloned a public repository which is not owned by me. I made changes to that repository. Now after committing the changes , when i am trying to push i am getting this error--

$ git push origin master
remote: Permission to navindian/******.git denied to Arpan619Banerjee.
fatal: unable to access '<github URL of that repo>': The requested URL returned error: 403

Pls tell me how can I push the changes. I have taken the userid and password from the owner of the repository.

Arpan Banerjee
  • 826
  • 12
  • 25

3 Answers3

4

You can not push to a public repository. You have to be added as a contributor by the owner of the repo.

But you can do code changes in that repo through merge requests via a fork.

If you are on GitHub:

  1. Fork the repository
  2. Clone the forked repo
  3. make the changes and commit it to the forked repo
  4. raise a merge request to the original repo.

Once the merge request is reviewed, it should be merged.

Raju
  • 2,299
  • 2
  • 16
  • 19
  • I did not notice that you have the credentials. if you have that there should not be any problem. – Raju May 01 '20 at 15:32
2

What Raju says for forking is the way to go if you don't own the repository or are not added as a contributor.

However, since you wrote:

Pls tell me how can I push the changes. I have taken the userid and password from the owner of the repository."

I would check my (aka. your) your local git environment because it seems that it still uses your credentials and not the credentials of the repository owner. Make sure that you add SSH key to your local machine and his github profile. Also, don't forget to modify git config, e.g.

  • git config --global user.email "Owner's email address"
  • git config --global user.name "Owner's Name and Surname"
CleanCoder265
  • 574
  • 1
  • 5
  • 22
0

I saw an answer in satckoverflow, and it worked.

Go to:

  • Start menu
  • search for credentials manager
  • under Windows Credentials there will some credentials related to Github.
  • Delete that.
  • Now if u issue the push command again
  • it will prompt for user name and password
  • enter the required details

It will push the changes. You might get some merge conflicts, so might have to pull some changes first before pushing .

Here is the link--

Original Answer

Arpan Banerjee
  • 826
  • 12
  • 25