.gitignore for Xcode Project [英] .gitignore for Xcode Project
问题描述
.gitignore
。我在公共回购中最为紧张的主要区域是我的Parse和Facebook钥匙。 Facebook密钥设置在我的 .plist
中,我的Parse键出现在我的 AppDelegate.swift
文件中。我的方法应该是怎样的,以及如何设置环境变量以防止将来出现问题。如果推荐的,从 Pro Git book )
主要思想是:如果数据是机密的, 不应该在repo(总是)中:smudge脚本将使用repo中之外的实际值替换占位符值。
I'm always nervous to make pushes of code to a Github repo with authentication tokens and variables. I have had an issue in the past with exposed keys and since I am new to Xcode, I'm curious as to what files I should be adding to .gitignore
. The main areas where I am most nervous about displaying in my public repo is my Parse and Facebook keys. The Facebook keys are set up within my .plist
and my Parse keys appear in my AppDelegate.swift
file. What should my approach be, and going forward, how should I set up environment variables to prevent issues in the future.
If the recommended Swift.gitignore
does not ignore those files, then you would need to manage them with a content filter driver (using .gitattributes
declaration).
The idea is to manage those plist or swift files in version, but with template placeholders in place of the actual (sensitive) values.
- the smudge part could replace the template content with the actual value (on checkout)
- the clean part could restore the template (on commit)
(image from "Customizing Git - Git Attributes", from "Pro Git book")
The main idea is: if a data is confidential, it should not be in the repo (at all): the smudge script would replace the placeholder values with actual values fetched outside of the repo.
这篇关于.gitignore for Xcode Project的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!