3

'git push' command failed when I was trying to push a new file to a forked repository. The error I get is as follows: ! [remote rejected] master -> master (permission denied) I am the owner of the forked repository so I am not sure why I get this error. I appreciate help with that. tnx

Revital Eres
  • 233
  • 5
  • 18

5 Answers5

3

Are you sure you're pushing to the right remote? Run the command git remote -v and confirm that the origin remote is a repository you have access to. If not, push to the remote you do have access to like:

git push -u <remote name> <branch name>

This will set your local branch up to track the given remote branch, so that git push will push to that by default. You may also need to change the setting of push.default if it has been changed.

Chris
  • 1,613
  • 17
  • 24
1

Make sure the remote is your repository:

$ git remote -v
origin  https://github.com/octocat/Spoon-Knife.git (fetch)
origin  https://github.com/octocat/Spoon-Knife.git (push)

If that is not yours, change it like this:

$ git remote set-url origin https://github.com/USERNAME/REPOSITORY.git
$ git remote -v
origin  https://github.com/USERNAME/REPOSITORY.git (fetch)
origin  https://github.com/USERNAME/REPOSITORY.git (push)

An then try to push again

$ git push origin master
Julio Daniel Reyes
  • 5,489
  • 1
  • 19
  • 23
0

Try following steps

git config --global --edit

Then add following to conf file

[credential]
  helper = osxkeychain
  useHttpPath = true
Nisal Edu
  • 7,237
  • 4
  • 28
  • 34
0

Check your email privacy policy. And unCheck checkmark from "Keep my email addresses private".

Settings -> Emails

Joffe
  • 1
  • 1
  • As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Mar 16 '23 at 16:14
-1

Try

git push origin master

if this is the first time you're pushing to this forked repository

person
  • 458
  • 3
  • 16
  • Have you checked out the fixes in [this question](https://stackoverflow.com/questions/25545613/how-can-i-push-to-my-fork-from-a-clone-of-the-original-repo)? Similar issue I think – person Oct 17 '17 at 20:15