git提交新項目至GitLab或GitHub

1、Git global setup(全局設置)

git config --global user.name "你的名稱"
git config --global user.email "你註冊的郵箱地址"

2、下載項目增加文件並提交

git clone 要下載的項目地址
cd 下載項目的文件夾
touch README.md
git add README.md
git commit -m "add README"
git push -u origin master

3、本地新項目推送至服務器

cd 項目文件夾
git init
git remote add origin 服務器項目地址
git add .
git commit
寫入提交信息 並按Esc鍵 然後輸入:wq
git push -u origin master

如果想在不設置ssk的基礎上提交本地項目值GitHub或GitLab則可以現在GitHub或GitLab上創建一個空的項目,然後把空項目clone到本地,然後把自己的項目代碼全部複製進去,然後就可以提交了(機智如我)。
如果出現src refspec master does not match any 錯誤 請參考
http://blog.csdn.net/fenfenguai/article/details/79032822

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章