.gitignore for Xcode Project [英] .gitignore for Xcode Project

查看:112
本文介绍了.gitignore for Xcode Project的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我总是很紧张,用代码令牌和变量将代码推送到Github repo。过去我曾经遇到过一些问题,因为我是Xcode的新手,我很好奇我应该添加哪些文件到 .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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆