1、在gitlab创建远程仓库

2、本地新建一个iOS项目

3、终端cd到项目所在目录,并输入如下命令,初始化这个本地的目录为一个Git可以管理的仓库
git init
4、然后就会变成如下这样:

5、然后按以下方式添加一下忽略文件gitignore

6、配置一下gitignore里面的内容,便于后续提交代码省去不必要的变动提交,
以下为gitignore里面的内容,讲以下的test改成自己的项目名称就可以
*.xcscheme
*.xcuserstate
*.xcbkptlist
xcuserdata
xcshareddata
test/.idea/misc.xml
test/.idea/modules.xml
test/.idea/test.iml
test/.idea/workspace.xml
test/.idea/xcode.xml
test/.idea/codeStyles/Project.xml
7、然后想成如下的结构

8、输入如下命令将本地仓库与远程仓库进行关联:
git remote add origin '自己在gitlab上构建项目的地址'
9、执行git add .(添加所有的改变)
10、执行git commit -m "first commit"(第一次提交)
11、git push -u origin master(提交到远程仓库)
网友评论