2

I create new project in Rstudio, and I opened github project repository as well. However, I intend to push all my project implementation to github page, but Git complaints with following error:

$ git push -u origin master
remote: Permission to JulaitiShayiding/mspc.git denied to julaiti.
fatal: unable to access 'https://github.com/JulaitiShayiding/mspc.git/': The requested URL returned error: 403

I used those git command to do this:

cd /path/to/my/repo
rm -rf .git
git init
git add --all
git commit -m "Initial commit"
git remote add origin "https://github.com/JulaitiShayiding/mspc.git"
$ git pull --rebase origin master
git push -u origin master
$ git pull origin master

Edit:

I tried of adding .gitignore file by using git add .gitignore, but still can't work with solving permission denied problem. The .gitingore file has following content:

.Rproj.user
.Rhistory
.RData

I looked into the related post in SO, and tried all of them git permission denied, but still, can't solve my problem. Can anyone help me out with this issue? How to fix this bug? Any idea? Thanks in advance :)

Community
  • 1
  • 1

1 Answers1

2

Looks like you do not have permission to push to repository https://github.com/JulaitiShayiding/mspc.git/. To push to a repository you either have to be the owner of the repository or you have to be a collaborator of the repository. To do so either go to repository settings and add yourself as a collaborator or ask the owner to add you as a collaborator.

enter image description here

If it's not your repository and you're not able to get a collaborator you can fork the repository to your account, do some changes and then create a pull request to the original repository. This pull request then has to be accepted by the owner or by a collaborator of the repository.

rufer7
  • 3,369
  • 3
  • 22
  • 28
  • @datageek did you provide your GitHub credentials when pushing? – rufer7 Mar 28 '17 at 14:04
  • @datageek try to execute `git remote set-url origin https://yourusername@github.com/user/repo.git` and then you should be prompted for the password when pushing – rufer7 Mar 28 '17 at 14:11
  • @datageek please verify if in your `.gitconfig` (On Windows under `C:\Users\USERNAME\.gitconfig`) the correct `name` and email address are present (Same information you used for registration at GitHub). – rufer7 Mar 28 '17 at 14:25
  • Did you verify what name is specified in your `.gitconfig`? – rufer7 Mar 28 '17 at 14:38
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/139267/discussion-between-rufer7-and-datageek). – rufer7 Mar 28 '17 at 14:46