git本地仓库到远程
-
git init //初始化仓库
-
git add .(文件name) //添加文件到本地仓库
-
git commit -m “first commit” //添加文件描述信息
-
git remote add origin + 远程仓库地址 //链接远程仓库,创建主分支
-
git pull origin master // 把本地仓库的变化连接到远程仓库主分支
-
git push -u origin master //把本地仓库的文件推送到远程仓库
1.注意顺序不要改变,先pull再push
2.注意 -u 不能少
如果遇到报错
Updates were rejected because the tip of your current branch is behind
就输入命令
git pull --rebase origin master
进行代码合并
再git push -u origin master