一:上传项目到git
1、在git创建space,复制ssh地址
2、打开终端,cd到项目根目录
cd 需要上传的项目根目录
3、初始化本地仓库
git init
4、添加目标文件至本地仓库
git add .
5、提交
git commit -m “提交注释”
6、关联远程仓库,其中origin后面是github上需要关联的仓库网址。
git remote add origin ssh地址
7、git push origin master
二:gitignore 忽略上传pods/cocoaPods 文件
创建gitignore文件
打开terminal (终端)
输入指令: cd '项目目录'
输入指令: vim .gitignore
copy 到终端
# Xcode
.DS_Store
*.pbxuser
!default.pbxuser
*.mode1v3
!default.mode1v3
*.mode2v3
!default.mode2v3
*.perspectivev3
!default.perspectivev3
!default.xcworkspace
project.xcworkspace
xcuserdata
profile
*.moved-aside
DerivedData
.idea/
# Pods - for those of you who use CocoaPods
Pods
Podfile.lock
build/
*.xcworkspace
build-upload
build-upload.*
dSYM/
按 esc 键 ,输入指令 :wq (保存并返回上一层)
再重新commit 提交 push到远端即可;
如果之前的项目已经提交到远端过就将.gitignore 拷贝到目录下,将pod相关文件都删除,重新提交,再重新pull就会发现已经被忽略掉了
clone代码后目录结构(pod相关文件已经被忽略掉了)

重新pod install 后项目目录

网友评论