github上建立私有項(xiàng)目需要收費(fèi)菲饼,作為替代品的coding.net則提供了免費(fèi)的私有項(xiàng)目管理,僅要求單個(gè)項(xiàng)目不超過1G列赎,而且作為國(guó)內(nèi)服務(wù)宏悦,無需翻墻,速度有保障,值得嘗試饼煞。
所需環(huán)境安裝
包括git源葫、AndroidStudio等,具體步驟略
建立本地Repository
在AndroidStudio菜單欄上選擇“VCS/Enable Version Control Integration...”
在彈出的窗口中選擇“git”砖瞧,點(diǎn)擊OK
建立.gitignore文件
此時(shí)在項(xiàng)目根目錄下已經(jīng)產(chǎn)生了一個(gè).gitignore文件息堂。但顯然并不夠用,因此我們從這里下載Android.gitignore文件
之后按需修改即可芭届。文件代碼如下:
# Built application files
*.apk
*.ap_
# Files for the ART/Dalvik VM
*.dex
# Java class files
*.class
# Generated files
bin/
gen/
out/
# Gradle files
.gradle/
build/
# Local configuration file (sdk path, etc)
local.properties
# Proguard folder generated by Eclipse
proguard/
# Log Files
*.log
# Android Studio Navigation editor temp files
.navigation/
# Android Studio captures folder
captures/
# Intellij
*.iml
.idea/workspace.xml
.idea/tasks.xml
.idea/libraries
# Keystore files
*.jks
# External native build folder generated in Android Studio 2.2 and later
.externalNativeBuild
在coading.net上創(chuàng)建項(xiàng)目倉(cāng)庫(kù)
略
添加coding.net遠(yuǎn)程倉(cāng)庫(kù)
打開Git Bash進(jìn)入項(xiàng)目目錄储矩,輸入以下命令:
git add
git commit -m "first commit"
git remote add origin 你在coding.net遠(yuǎn)程倉(cāng)庫(kù)地址
git push -u origin maste
//以下為可選
git pull origin
git push origin master -f
在彈出的界面輸入coding.net的用戶名密碼即可。
添加SSH公鑰
為了避免每次提交都要輸入用戶名密碼褂乍,需要給coding.net添加一個(gè)SSH公鑰持隧,詳見:Coding.net配置SSH公鑰