Xcode > 源代码管理 > 创建 Git 存储库

Xcode > Source Control > Create Git Repositories

我使用 Xcode 10 Mac OS X Mojave。我去了

源代码管理 > 创建 Git 存储库以创建我的初始提交

看来成功了。但是我不确定我的 Xcode 我的代码推送到哪里了?

在我的 Xcode 中,我查看了源代码,我看到了这个

在我的 Bitbucket 帐户中,我没有看到任何推送或创建的内容。 Bitbucket 是我在 Xcode > preferences.

中链接的唯一帐户

我运行git config --list,我得到了

⚡️  Alimofire  git config --list
credential.helper=osxkeychain
user.name=john doe
user.email=john@outlook.com
core.excludesfile=/Users/bheng/.gitignore_global
core.filemode=false
difftool.sourcetree.cmd=opendiff "$LOCAL" "$REMOTE"
difftool.sourcetree.path=
mergetool.sourcetree.cmd=/Applications/SourceTree.app/Contents/Resources/opendiff-w.sh "$LOCAL" "$REMOTE" -ancestor "$BASE" -merge "$MERGED"
mergetool.sourcetree.trustexitcode=true
push.default=matching
commit.template=/Users/bheng/.stCommitMsg
core.bare=false
core.repositoryformatversion=0
core.filemode=true
core.ignorecase=true
core.precomposeunicode=true
core.logallrefupdates=true

我的代码现在在哪里?

当您选择源代码管理 > 创建 Git 存储库时,您在 Mac 上创建了一个本地 git 存储库。该命令不会创建 Bitbucket 存储库或将更改推送到 Bitbucket。

使用 Xcode 的源代码管理导航器将您的项目放在 Bitbucket 上。通过选择 View > Navigators > Show Source Control Navigator 打开 Source Control 导航器。 Select Remotes 文件夹,按住 Control 单击并选择“创建远程”以在 Bitbucket 上创建远程存储库。

避免在存储库名称中包含大写字母。如果存储库名称中有大写字母,Xcode 会打开一个警告,提示 发生未知错误。这是 Bitbucket 存储库的问题,而不是 GitHub 存储库。

选择“源代码管理”>“推送”将您的更改推送到 Bitbucket。您可以在以下文章中找到更多详细信息:

Putting Your Xcode Project on GitHub, Bitbucket, or GitLab