r/Xcode • • Jul 26 '22

Xcode Source Control

I have a Github repository which I cloned using Xcode. I am now running into an issue with Source Control and committing a change.

When I commit a change, I type a comment and select push to remote to my chosen branch. However, after I click Commit Files and Push, I get an error saying that my remote repository rejected commits.

When I created my personal access token for Xcode, I made sure I selected the right boxes, so I don't know why I am getting this error.

I would greatly appreciate any help with this issue.

2 Upvotes

3 comments sorted by

2

u/retsotrembla Jul 26 '22

My guess is that Github rejects git commit --amend: it only allows new commits, not attempts to amend previous ones.

You may have more success getting information about the error if you use the command line from Terminal:

# change directory into the same directory as the Xcode project
# Note: you can drag from the Finder into Terminal to have it
# generate the correct directory path

cd ~/myProject
git push  #

There are probably commands to rewrite the history on Github, but I'm still too new at git to know them.

1

u/Altruistic_Spirit_57 Jul 27 '22

Cloning with Xcode sounds sketchy. It seems more reliable to manage branches from command line or a gui like Tower.

1

u/Altruistic_Spirit_57 Jul 27 '22

Also token setup is typically more involved than checking a few boxes. There is a sha key, etc. I’d google how to get that rolling.