Xcode 9.2无法配置主分支的git源代码控制 [英] Xcode 9.2 Unable to configure git source control for master branch
问题描述
我创建了一个新的Xcode项目,同时也选择了下面的选项:
然后在编码之后,我去了源代码控制菜单并选择了提交。
在我提交了我的文件之后,我的主分支也不可见了
我需要添加一个远程存储库,并将此xcode项目推送到github存储库。
我尝试了所有这些解决方案: / p>
切换回命令行以了解更多信息:
cd / path / to / my / local / repo
git status
如果您看到主分支,请检查远程
git remote -v
如果您没有看到:
git remote add origin / url / github / empty / repo
git fetch
git分支-u原产地/ master master
git pull --rebase
git push -u原产地主人
因为 master
现在与关联
origin / master ,下一次推送将简单地为 git push
。
I created a new Xcode project and also selected below option:
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
I need to add a remote repository and push this xcode project to github repository.
I have tried all these solutions:
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:
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
.
这篇关于Xcode 9.2无法配置主分支的git源代码控制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!