git 本地倉庫關聯到遠程倉庫


將本地倉庫關聯到遠程倉庫

方式一:遠程倉庫沒有文件

step_one:  git init(初始化git倉庫);

step_two:  git remote add 地址(設置remote地址);

step_three:   git add . (將所有變更提交到本地倉庫);

step_four:  git commit -m '' (提交注釋);

step_five:   git push(本地倉庫推送到遠程倉庫)

方式二:遠程倉庫有文件

step_one:  git init(初始化git倉庫);

step_two:   git remote add origin 地址(設置遠程remote地址);

step_three:   git pull origin master(拉取遠程倉庫master的文件)

step_four:  git branch --set-upstream-to=origin/master master(將本地master設置為遠程master分支)

step_five:   git add . (將所有變更提交到本地倉庫);

step_six:    git commit -m '' (提交注釋);

step_seven:    git push(本地倉庫推送到遠程倉庫)

方式三:

step_one:  建一個文件夾,進入文件夾打開命令行工具;

step_two:  git clone 地址(克隆遠程倉庫);

step_three:    將項目文件復制到新建文件夾中;

step_four:    git add . (將所有變更提交到本地倉庫);

step_five:  git commit -m '' (提交注釋);

step_six:         git push(本地倉庫推送到遠程倉庫)

設置用戶和郵箱

一:全局

git config --global user.name "you name"

git config --global user.email "you email"

二:局部(單個項目)

git config user.name "you name"

git config user.email "you email"

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM