'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
Asked
Active
Viewed 1,442 times
4 Answers
1
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,551
- 14
- 21
0
Try following steps
git config --global --edit
Then add following to conf file
[credential]
helper = osxkeychain
useHttpPath = true
Nisal Edu
- 6,289
- 4
- 25
- 33
-
run git remote -v what you see ? – Nisal Edu Oct 17 '17 at 20:12
0
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
- 4,319
- 1
- 16
- 22
-1
Try
git push origin master
if this is the first time you're pushing to this forked repository
person
- 448
- 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