Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Xcode and Github not playing together

Trying to use Github for the first time with xCode giving me hard time.

I followed many tutorials but nothing is working for me.

  1. using my Github account, created repo for the project
  2. opened Xcode and created project, with the git check mark checked
  3. opened the source control menu and attached to the Github repo origin/master
  4. tried to push and got: "The local repository is out of date. Make sure all changes have been pulled from the remote repository and try again." message
  5. tried to pull and got: ""origin/master" is not a valid remote branch to pull from. Please choose a different remote branch." but there is not other branch.
  6. tried every thing else and nothing worked

p.s. the first time i did the connection to the remote server i got a popup to enter user and password, now not getting that any more, so i am getting that the connection is not the problem, i can see (or think i can see) the remote repo

Any one got an idea?

Push:

enter image description here

Pull:

enter image description here

like image 612
Erez Avatar asked Aug 01 '26 22:08

Erez


2 Answers

I use the command line most of the time. I can suggest you a better way to do this for your purpose.

Follow below steps :

  • Open terminal.

  • Type following command

git clone --recursive https://github.com/EXAMPLE_PROJECT/EXAMPLE.git

  • Go inside the folder and double click on the xcode project file(If the project is already present in the github). Suppose if the project is not in the github then copy and past it inside this folder and double click on .xcodeproj
  • Once the project loads in the xcode, click on the "Source Control" on menu bar.
  • You will see the commit, push, pull options are visible. Now you should be able to work with git.

Note:

If there is no github account details present in keychain terminal will ask to enter.

If you are using more than one user account in github, then you may have to delete the github account details from key chain. I am not sure how to setup for multiple github account.

like image 157
MD Aslam Ansari Avatar answered Aug 04 '26 13:08

MD Aslam Ansari


OK, fixed the problem!

Notice when you add README or gitignore files when creating a git repo, nothing that i did could push or pull from and to the local copy.

eventually i deleted the Github repo and created a clean repo with no files in it.

Then did the steps from the main repo page and every things worked just fine.

I thing the issue was that i had deferent files in both the Github repo and the local git repo (the local one has the Xcode project files) and it gave me error after error for many things, starting from clean Github repo and getting the gitignore file in advance and adding it to the local project did the trick for me.

10x and i hope that helped

like image 34
Erez Avatar answered Aug 04 '26 12:08

Erez



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!