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"

 

posted @ 2020-04-08 14:09  十方故里  阅读(1123)  评论(0)    收藏  举报