Archive for the ‘Android’ Category

Add Android Studio project to Github

28 八月, 2018

1. 在 github 上開啟新的專案ads-to-github-0

記得在 .gitignore 裡勾選 Android, 這會產生一個 gitignore 檔案

ads-to-github-1

2. 設定 Android Studio 到 github 的連結

在 File/Settings/Version Control/Github 打開設定頁面. Auth Type 選擇 Password.

填入 Login/Password 之後, 可以測試是否正常連接

ads-to-github-2

3. 準備本地端專案目錄

3.1 建立 git repo

git init

3.2 從 github 上剛建立的專案中, 已產生的 .gitignore 複製到本地端的 .gitignoreads-to-github-4

3.3 加入本地端的檔案

git add .gitignore

git add .

4. 加入檔案到 github

4.1 回到 Android Studio , 檔案名稱已經都變成綠色的. 表示已經加入 git repo

4.2 打開 VCS/git/remotes, 點選 ‘+’ 號, 在 Define Remote 視窗, 填入git 上  專案的連結

ads-to-github-5

4.3 打開 VCS/commit, 將檔案 commit 到 github

ads-to-github-6