'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
5 Answers
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.

- 1,613
- 17
- 24
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

- 5,489
- 1
- 19
- 23
Try following steps
git config --global --edit
Then add following to conf file
[credential]
helper = osxkeychain
useHttpPath = true

- 7,237
- 4
- 28
- 34
-
run git remote -v what you see ? β Nisal Edu Oct 17 '17 at 20:12
Check your email privacy policy. And unCheck checkmark from "Keep my email addresses private".
Settings -> Emails

- 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
Try
git push origin master
if this is the first time you're pushing to this forked repository

- 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