1、首先建立本地的git文件夾
第一步:建立git倉庫
cd到你的本地項目根目錄下厅目,執(zhí)行g(shù)it命令
git init
第二步:將項目的所有文件添加到倉庫中
git add .
如果想添加某個特定的文件贴捡,只需把.換成特定的文件名即可
第三步:將add的文件commit到倉庫
git commit -m "注釋語句"
第四步:去github上創(chuàng)建自己的Repository忽肛,創(chuàng)建頁面如下圖所示:
拷貝倉庫地址,形式如下:
https://github.com/github_username/project_name
第五步:重點來了烂斋,將本地的倉庫關(guān)聯(lián)到github上
git remote add origin https://github.com/hanhailong/CustomRatingBar
第六步:上傳github之前麻裁,要先pull一下,執(zhí)行如下命令:
git pull origin master(做不了就算了源祈,可以接著下一步)
第七步煎源,也就是最后一步,上傳代碼到github遠程倉庫
git push -u origin master
如出現(xiàn)如下提示:
to set your account's default identity.
Omit --global to set the identity only in this repository.
需設(shè)置git的用戶名和地址:
git config --global user.name "XXX"
git config --global user.email "XXX"