標籤:
鄙人初次發表,如有不妥之處,敬請批評指正
1,安裝git。 git:http://git-scm.com/downloads/
2,在AS 的File->Settings->Version Control->Git 配置git.exe命令路徑,如:
配置AS 的git
配置完成後,如果點擊"Test" 按鈕提示successfully,則說明配置成功。
3.在[email protected]上建立倉庫,擷取倉庫地址。
現在這裡我的倉庫地址是:https://git.oschina.net/qule510/GitDemoTest.git
4.建立AS項目。
5.在AS中選擇項目,建立並初始化git本地倉庫。如:
6.(進入重點) 進入項目目錄,右鍵進入git命令列視窗。
首先,你需要執行下面兩條命令,作為git的基礎配置,作用是告訴git你是誰,你輸入的資訊將出現在你建立的提交中.
git config --global user.name "你的名字或暱稱"
git config --global user.email "你的郵箱"
如果設定過了 可以忽略上面步驟。
輸入命令:
git remote add origin <你的項目地址> //這裡我的遠程倉庫地址是:https://git.oschina.net/qule510/GitDemoTest.git
git pull origin master
git touch init.txt //如果已經存在更改的檔案,則這一步不是必須的
git add .
git commit -m "第一次提交" //這裡填寫提交內容
git push origin master //推送
按照上面幾步,就可以成功的分享
如果這個時候更新出現問題提示:Can‘t update: no tracked branchNo tracked branch configured for branch master.To make your branch track a remote branch call, for example,
git branch --set-upstream master origin/master
按照它的說法,執行git branch --set-upstream master origin/master 之後就可以更新了。
溫馨提示:想看更詳細的步驟,可以查看OSC的 git協助文檔 :http://git.mydoc.io/
android studio怎麼分享項目到[email protected]託管