4

In Ruby on Rails, I know there's a config/secrets.yml file which I shouldn't upload to github.

Is there anything equivalent in an iOS app? I'm thinking about uploading my app to github before submitting it to the Apple app store, and I don't want to accidentally share any secret keys or anything else that should remain private.

m81
  • 2,217
  • 5
  • 31
  • 47
  • Possible duplicate of [Git ignore file for Xcode projects](http://stackoverflow.com/questions/49478/git-ignore-file-for-xcode-projects). – Martin R Jul 23 '15 at 17:36
  • Are you specifically worried about uploading api access keys type secrets? – thelaws Jul 23 '15 at 17:39
  • @thelaws, yup - don't want to accidentally give away a private key or anything like that. – m81 Jul 23 '15 at 17:52
  • ios apps don't include any obviously secret information. If you have other secrets in a config file somewhere, you just need to add it to the gitignore to prevent it from being tracked by git. – thelaws Jul 23 '15 at 17:54
  • ahh, thanks for letting me know. I can modify the question so that it's easier to figure out what I'm asking. – m81 Jul 23 '15 at 17:59

2 Answers2

4

GitHub maintains a public project with the .gitignore recommendations for several languages: https://github.com/github/gitignore

For XCode this is how the file looks:

# 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

## 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:
# http://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
#
#Pods/

# Carthage
#
# Add this line if you want to avoid checking in source code from Carthage dependencies.
# Carthage/Checkouts

Carthage/Build
bitoiu
  • 6,893
  • 5
  • 38
  • 60
1

This is what I've been using for a .gitignore file in a few projects:

# Exclude temp nibs and swap files
*~.nib
*.swp

# Exclude OS X folder attributes
.DS_Store
.svn

# Exclude user-specific XCode 3 and 4 files
*.mode1
*.mode1v3
*.mode2v3
*.perspective
*.perspectivev3
*.pbxuser
*.xcworkspace
xcuserdata

I think that handles Xcode's user-specific local project files and OS X temp files, while preserving everything you need for a project to build straight from the repository.

Brad Larson
  • 170,088
  • 45
  • 397
  • 571