Add local repo for existing Xcode 5 Project

為{幸葍}努か 提交于 2019-12-03 01:32:40

问题


I've running through a Xcode 5 tutorial and want to make some significant changes, but want to make this Xcode 5 project into a repository.

I've done some reading and you can add a repository by going to Xcode -> Preferences -> Accounts -> Add Respository -> Enter the repository address:

So what would I input here for a local repository (on my iMac) I'm wanting to work on?

Cheers.


回答1:


I would do this from the command line.

  1. Close Xcode.app
  2. Open Terminal.app
  3. $ cd /path/to/project/dir
  4. $ git init .
  5. Create a .gitignore file to ignore some of the Xcode and output files that you don't want tracked (see below).
  6. $ git add .gitignore
  7. $ git add .
  8. $ git commit -a -m Initial.

Sample (but incomplete) .gitignore file:

build/
*/xcuserdata/

And most likely you'll want to add a remote tracking repo, perhaps on github or bitbucket (once a bare repo has been created there):

$ git remote add origin https://bitbucket.org/yourname/yourrepo.git
$ git push -u origin --all
$ git push -u origin --tags

When you open the Xcode project next time it will be ready for Source Code use.




回答2:


Apple's official solution is here. See "Use Git to Manage an Unmanaged Workspace Directory on a Development Mac"




回答3:


That's only for already existing repos that are stored somewhere outside of your project directory. You can create a new repo by opening the terminal in the top-level folder of your project, and then typing git init. Your repo is now created and will automatically be recognized by Xcode.



来源:https://stackoverflow.com/questions/19495141/add-local-repo-for-existing-xcode-5-project

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!