Android Studio上傳項目至github

1.Git下載與安裝

下載地址:
windows_64位下載地址
下載完成後,傻瓜式安裝即可。

2.Android Studio關聯Git

點擊File > Settings > Version Control > Git
點擊Test,選擇上一步git安裝好後git.exe的路徑
然後點擊Apply,再點擊OK
在這裏插入圖片描述
再次打開Settings窗口,點擊Test,出現Git executed Ssuccessfully彈窗,說明關聯成功
在這裏插入圖片描述

3.配置github賬號信息

點擊File -> Settings -> Version Control -> GitHub
在Auth Types中選擇Password,
輸入github的賬戶和密碼(若無賬號,請先 註冊github賬號。)
點擊Test,查看賬號密碼是否輸入正確。若出現Connection successful彈窗,說明輸入正確。
Test成功後,點擊Apply,再點擊OK
在這裏插入圖片描述

4.配置忽略文件.gitnore

上傳項目前,有許多文件不必要上傳到github,需要忽略上傳。
所以,配置.gitignore文件(位於app目錄下)。
在這裏插入圖片描述
文件內容改爲

# Built application files
*.apk
*.ap_

# Files for the Dalvik VM
*.dex

# Java class files
*.class

# Generated files
bin/
gen/

# Gradle files
.gradle/
build/

# Other files
app/build/
local.properties
.idea
*.iws
*.iml

# Local configuration file (sdk path, etc)
local.properties

# Proguard folder generated by Eclipse
proguard/

# Log Files
*.log

# =========================
# Operating System Files
# =========================

# OSX
# =========================

.DS_Store
.AppleDouble
.LSOverride

# Thumbnails
._*

# Files that might appear on external disk
.Spotlight-V100
.Trashes

# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk

# Windows
# =========================

# Windows image file caches
Thumbs.db
ehthumbs.db

# Folder config file
Desktop.ini

# Recycle Bin used on file shares
$RECYCLE.BIN/

# Windows Installer files
*.cab
*.msi
*.msm
*.msp

# Windows shortcuts
*.lnk

5.上傳項目至Github

點擊VCS > Import into Version Control > Share Project on Github
在這裏插入圖片描述
填寫好相關信息並上傳。
上傳完成後即可在github的repositories看到上傳的項目。
在這裏插入圖片描述
點擊項目可查看詳情
在這裏插入圖片描述

6.更新項目到Github

當更改了項目的內容後,
點擊VCS > Commit…
在這裏插入圖片描述
在Commit Message填寫相關信息
選擇Commit and Push方式提交更新。
在這裏插入圖片描述

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章