android studio配置git和github進行版本控制

1.安裝配置

默認大家都已經安裝了Git軟件,參考下圖進行git與as關聯

  • 配置git ,找到你的git安裝的bin目錄
    配置git

  • 設置GitHub用戶信息 
    配置GitHub賬號信息

  • 填寫完用戶名,密碼後可以點擊Test,出現下圖怎麼配置成功

    測試是否連通

2.分享項目到GitHub

  • 開啓GitHun插件 
    分享

  • 創建關聯的庫,點擊Share進行分享

    創建關聯的庫

  • 點擊ok提交代碼

    提交代碼

這樣我們就把本地項目已經與github關聯起來了,請看下圖。左邊的是用來更新github上面的項目的,右邊是用來提交我們本地項目的 
這裏寫圖片描述

3.注意事項

Can’t finish GitHub sharing process 
Successfully created project ‘GitHubDemo’ on GitHub, but initial commit failed: 
* Please tell me who you are. Run git config –global user.email “[email protected]” git config –global user.name “Your Name” to set your account’s default identity. Omit –global to set the identity only in this repository. fatal: empty ident name (for ) not allowed during executing git -c core.quotepath=false commit -m “Initial commit xxx” –

由於剛配置的環境,沒有配置會出現這樣的錯誤。大致意思是需要一個名稱才能提交到github上面,解決辦法如下圖,第一個是設置郵箱地址,第二個是設置用戶名
這裏寫圖片描述

發佈了28 篇原創文章 · 獲贊 13 · 訪問量 8萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章