Reputation: 6870
I have a branch named develop that I pulled on, added some code, committed, pulled again, and am now trying to push but I get the following error message in Xcode:
The remote repository rejected commits.
Make sure you have permission to push to the remote repository and try again.
I switched to a different branch named feature and was able to pull and push on it fine.
I went to Xcode > Preferences > Accounts > Repositories then clicked on the repository I'm working on and verified my credentials and even re-entered them. But I still have the same problem (the feature branch works but the develop one throws up that message).
Why does the push work on one branch but not the other?
Upvotes: 4
Views: 6188
Reputation: 41
This happened to me because I branched off of our main branch and named my branch incorrectly, so I branched off that misspelled branch to fix the name and then deleted it which killed the upstream branch for Git.
The solution was to set the upstream via command line:
git push --set-upstream origin theUpstreamBranchYouWantToSet
Upvotes: 1
Reputation: 8491
I got this error today and it wasn't until I tried to commit via another method did I actually find the reason. I had a file that was 230Mb and GitHub doesn't allow files that big (or at least for the account I have). So Xcode just wasn't being very helpful with its error message
Upvotes: 10
Reputation: 534885
GitHub repositories can be configured with branch protection. You probably have permission only to push/pull the feature
branch and only to pull (but not push) the develop
branch.
Upvotes: 1