git local warehouse associated with remote warehouse

Associate the local warehouse to the remote warehouse

Method 1: There are no files in the remote warehouse

first step:

git init(初始化git仓库)

Step two:

 git remote add 地址(设置remote地址)

third step:

 git add . (将所有变更提交到本地仓库)

the fourth step:

 git commit -m '' (提交注释)

the fifth step:

git push(本地仓库推送到远程仓库)

Method 2: The remote warehouse has files

first step:

git init(初始化git仓库)

Step two:

git remote add origin 地址(设置远程remote地址)

third step:

git pull origin master(拉取远程仓库master的文件)

the fourth step:

 git branch --set-upstream-to=origin/master master(将本地master设置为远程master分支)

the fifth step:

 git add . (将所有变更提交到本地仓库)

Step 6:

git commit -m '' (提交注释)

Step 7: 

git push(本地仓库推送到远程仓库)

Method three: (recommended, I feel this is the easiest)

first step:  

  Create a folder, enter the folder and open the command line tool;

Step two:

git clone 地址(克隆远程仓库)

third step:

  Copy the project files to the new folder
Step 4:

git add . (将所有变更提交到本地仓库)

the fifth step:

 git commit -m '' (提交注释)

Step 6: 

 git push(本地仓库推送到远程仓库)

Set up user and email

One: overall situation

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

2: Partial (single project)

git config user.name "you name"
git config user.email "you email"

Original link: https://blog.csdn.net/sinat_39049092/article/details/113417142

Guess you like

Origin blog.csdn.net/liuqinhou/article/details/132547926