鄙人初次發表,如有不妥之處,敬請批評指正 1,安裝git。 git下載地址:http://git-scm.com/downloads/ 2,在AS 的File->Settings->Version Control->Git 配置git.exe命令路徑,如下圖: 配置AS 的git 配置AS 的git ...
鄙人初次發表,如有不妥之處,敬請批評指正
1,安裝git。 git下載地址:http://git-scm.com/downloads/
2,在AS 的File->Settings->Version Control->Git 配置git.exe命令路徑,如下圖:

配置AS 的git
配置完成後,如果點擊"Test" 按鈕提示successfully,則說明配置成功。
3.在git@osc上創建倉庫,獲取倉庫地址。


現在這裡我的倉庫地址是: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/