Ignoring Files for Source Control
11 January, 2021
When using Xcode to write programs with Swift, there are certain files that should never be committed to a repository.
To configure your system to ignore these files for the purposes of source control, first, visit this page.
You will see a couple of lines of text. Highlight this text with your cursor and then copy the text to your clipboard using the Command-C keyboard shortcut:
Next, open the Terminal application on your computer.
The easiest way to do this is to use the Spotlight search feature – click the magnifying glass in your menubar – top right corner of your screen.
Then, search for Terminal:
Once Terminal opens, it will look something like this:
In the Terminal window, use the keyboard shortcut Command-V to paste the contents of your clipboard.
Then, press Return on your keyboard to run the commands.
It will look like nothing happened.
However, your system is now configured to ignore the files that should never be committed to a remote repository.
You can verify this by opening Xcode, then choosing the menu sequence Xcode → Preferences and in the window that appears, choosing Source Control and then Git.
In the ignored files section, you should see content like what is pictured here:
While you are in this window, please double-check that you have supplied your name and LCS email address.
Now, you can close this window in Xcode by pressing the red button in the top-left corner of the window.
And, you can switch to Terminal, and close it, using the Command-Q keyboard shortcut.