xcode 创建项目后创建git仓库

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/6366966/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-14 21:16:47  来源:igfitidea点击:

Create git repository after project creation

xcodegitxcode4repository

提问by esqew

I know there's an option to make a local repository for your project when you first create it, but is there an option create a repository after you've created your project?

我知道有一个选项可以在您第一次创建项目时为您的项目创建一个本地存储库,但是在您创建项目之后是否可以选择创建一个存储库?

回答by Greg Hewgill

Sure, just run the following command in your project directory:

当然,只需在您的项目目录中运行以下命令:

git init

This will create the .gitdirectory containing an empty repository. Then, add and commit your files.

这将创建.git包含空存储库的目录。然后,添加并提交您的文件。

回答by elnino07

In the command prompt, make sure you're in the desired directory and perform a git initand you will have created an empty repository.

在命令提示符下,确保您位于所需目录中并执行 a git init,您将创建一个空存储库。

You can then proceed to add the files and directories to the repository by doing

然后,您可以通过执行以下操作继续将文件和目录添加到存储库

git add <filename1> <filename2> ...

or you can select whole directories and use *to act as a wild card of sorts.

或者您可以选择整个目录并*用作各种通配符。

git add ./*

If you have any more questions check out these pages:

如果您还有其他问题,请查看以下页面:

Hope this helps.

希望这可以帮助。

回答by Marco

You should go to your Xcode menu, click Source Control> Create Working Copy...

您应该转到 Xcode 菜单,单击Source Control> Create Working Copy...

Xcode will automatically create your .gitfolder repository.

Xcode 将自动创建您的.git文件夹存储库。

Good luck, and make sure you have a backup of your project before trying something else.

祝你好运,在尝试其他东西之前,请确保你有项目的备份。