美文网首页
2018-07-03 iOS 新建git项目上传到git时一定要

2018-07-03 iOS 新建git项目上传到git时一定要

作者: 幸福晓杰2016 | 来源:发表于2018-07-03 16:53 被阅读29次

    在对应的文件夹下 输入 shift + command + . 一键打开/隐藏系统隐藏文件。

    使用命令 快速创建.gitignore文件

    touch .gitignore
    

    iOS 标准的.gitignore 官方建议版本

    # Xcode
    #
    # gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore
    
    ## Build generated
    build/
    DerivedData
    
    ## Various settings
    *.pbxuser
    !default.pbxuser
    *.mode1v3
    !default.mode1v3
    *.mode2v3
    !default.mode2v3
    *.perspectivev3
    !default.perspectivev3
    xcuserdata
    
    ## Other
    *.xccheckout
    *.moved-aside
    *.xcuserstate
    *.xcscmblueprint
    *.xcscheme
    
    ## Obj-C/Swift specific
    *.hmap
    *.ipa
    
    # CocoaPods
    #
    # We recommend against adding the Pods directory to your .gitignore. However
    # you should judge for yourself, the pros and cons are mentioned at:
    # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
    #
    Pods/
    Podfile.lock
    
    # Carthage
    #
    # Add this line if you want to avoid checking in source code from Carthage dependencies.
    # Carthage/Checkouts
    
    Carthage/Build
    
    # fastlane
    #
    # It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the 
    # screenshots whenever they are needed.
    # For more information about the recommended setup visit:
    # https://github.com/fastlane/fastlane/blob/master/docs/Gitignore.md
    
    fastlane/report.xml
    fastlane/screenshots
    

    其中Pods/和Podfile.lock 是我本人加上去的,尤其时Podfile.lock,当协同开发的同事cocoapod不一致时,这里很容易起冲突。

    记住一定是在项目第一次上传前就建立好这个gitignore文件,否则后面再添加其实也没效果了。

    这个时候,可以尝试在服务器端删除这个文件,如Podfile.lock 然后更新本地仓库,然后重新执行命令 pod install
    这时候本地仓库有Podfile.lock 但是提交时却不会提交这个文件。问题可以得到解决。

    相关文章

      网友评论

          本文标题:2018-07-03 iOS 新建git项目上传到git时一定要

          本文链接:https://www.haomeiwen.com/subject/baljuftx.html