git上傳項目到gitee的基本步驟
1 git init
先進入項目文件夾使用 git init 命令,把這個目錄變成git可管理倉庫即版本庫repository
2 git add .
注意add后面有個點,與add之間有一空格,把文件添加到版本庫中,將本地項目使用 git add . 加入到緩存區stage,意為將目錄中的所有文件都添加到緩存區
add是把當前分支的變更暫存起來,但不生成版本, (本地倉庫開始關注此文件)
3 git commit -m "firstcommit"
git commit -m 命令生成版本,並告訴git將緩存區文件提交到本地分支,后面引號中的內容為提交說明(提交本地倉庫)
4 git remote add origin 你的遠程庫地址
關聯到遠程倉庫,例如:
git remote add origin https://github.com/githubusername/demo.git
其實是先remote添加了遠程倉庫,然后把自己的本地分支關聯到某個倉庫的某個分支
5.git pull --rebase origin master
獲取遠程倉庫與本地倉庫的合並(如果遠程倉庫不為空,比如,第二次提交,則必須進行這一步)
6 git push -u origin master
把本地倉庫的內容推送到遠程倉庫,使用git push實際上是把當前分支推送到遠程倉庫的關聯分支里
7 git status
查看狀態
最后,如果提示錯誤
Git 提示fatal: remote origin already exists 錯誤解決辦法
參考:https://blog.csdn.net/top_code/article/details/50381432
以下幾個博客,還要讀一下,做一個記錄。
https://blog.csdn.net/Waves___/article/details/88323312
https://blog.csdn.net/zyx_ly/article/details/89716796
https://blog.csdn.net/sclibingqing/article/details/81179470
https://www.cnblogs.com/wj-1314/p/9901763.html
https://www.cnblogs.com/wj-1314/p/7992543.html
