.gitignore is a file that does not upload code to git (Github) that may cause problems if it is known to others such as APIKey.
It is treated as part of security.
Move to the target project directory in the terminal and create a file with the following command
% touch .gitignore
Open the created file with the following command
% open .gitignore
Write the following code in the opened file
# Xcode build/ *.pbxuser !default.pbxuser *.mode1v3 !default.mode1v3 *.mode2v3 !default.mode2v3 *.perspectivev3 !default.perspectivev3 xcuserdata *.xccheckout *.moved-aside DerivedData *.hmap *.ipa *.xcuserstate # CocoaPod Pods/* # others *.swp !.gitkeep .DS_Store
Also, if you create
.gitignore in the middle of development (if you have already committed to git),
Set all files out of git once with the following command
git rm -r --cached .
Next, set it as the target of git again
git add .
By executing these two commands, the files registered in
.gitignore will not be uploaded even during development.
However, I've never had a hard time creating a
.gitignore file right after creating a project.
As the default setting of Mac, files starting with
. (Dot) can no longer be viewed, so even if you create a
.gitignore file, it will not be displayed in Finder etc. (So open from the terminal)
If you want to check it properly with Finder etc., please refer to How to show/hide hidden files in Finder on Mac.