Mamta
Mamta

Reputation: 921

Xcode 9.2 Unable to configure git source control for master branch

I created a new Xcode project and also selected below option:

enter image description here

Then after some coding I went to source control menu and selected commit. After I committed my files, then also my master branch isn't visible

enter image description here

I need to add a remote repository and push this xcode project to github repository.

I have tried all these solutions:

Raywenderlich

Appcoda

All answers from this stackoverflow link too

What could the issue be? I am using git version control for the first time so unable to figure out what's missing.

EDIT Using @VonC Solution:

Getting this error when I push using command line:

 ! [rejected]        master -> master (fetch first)
error: failed to push some refs to 'https://github.com/xia.....'
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first integrate the remote changes
hint: (e.g., 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.

EDIT 2 :

This is what branch I have at my github page:

enter image description here

Upvotes: 2

Views: 600

Answers (1)

VonC
VonC

Reputation: 1326782

Switch back to the command line to know more:

cd /path/to/my/local/repo
git status

If you see a master branch, check the remote

git remote -v

If you don't see one:

git remote add origin /url/github/empty/repo

git fetch
git branch -u origin/master master
git pull --rebase

git push -u origin master

since master is now associated to origin/master, the next push will simply be a git push.

Upvotes: 2

Related Questions