我想將我的專案 key.properties 和 .jks 檔案保留在 GitHub 中,但是每當我在生成這些檔案后提交時,這些檔案都不會提交。
我知道將這些檔案保存在 GitHub 上可能會有風險,但我的存盤庫是私有的,只有我的拼貼可以訪問它們。
所以,我想將這些檔案保存在我的 GitHub 存盤庫中。
對此的任何幫助將不勝感激。
uj5u.com熱心網友回復:
提交這些檔案確實非常冒險。
如果您真的想提交它們并且不能提交,這里有兩個可能的原因:
- 您可能有一條規則
.gitignore說不提交這些檔案。 - 您可能在您的 Github 存盤庫中有一個擴展程式/機器人來檢查這些檔案是否已提交(例如 GitGardian),并且在這種特定情況下您可能希望為此存盤庫洗掉它。
uj5u.com熱心網友回復:
檢查android/.gitignore,默認情況下它有以下幾行:
key.properties
**/*.keystore
**/*.jks
洗掉或評論它們。
uj5u.com熱心網友回復:
您需要在 build.gradle 中撰寫以下代碼
signingConfigs {
release {
file("keystore/signin.properties").with { propFile ->
if (propFile.canRead()) {
def properties = new Properties()
properties.load(new FileInputStream(propFile))
storeFile file("keystore/${properties['storeFile']}")
storePassword properties['storePassword']
keyAlias properties['keyAlias']
keyPassword properties['keyPassword']
} else {
println "Unable to read signing.properties"
}
}
}
}
并將您的 jks 和 .properties 像下面的螢屏一樣保存在密鑰庫檔案夾中

還要在 signin.properties 中寫下您的 jks 詳細資訊,如下所示

轉載請註明出處,本文鏈接:https://www.uj5u.com/net/452559.html
上一篇:如何使用GithubActionsAPI獲取Github作業流yaml檔案
下一篇:未能將一些參考資料推送到“https://github.com/<username>/my-history.git”
