ukula 发表于 2018-1-12 23:35:02

【Git】本地与GitHub同步

  按步骤一步一步来,成功啦~
https://images2015.cnblogs.com/blog/1127793/201703/1127793-20170322203810174-745998039.png
  以管理员身份运行Git-bash
https://images2015.cnblogs.com/blog/1127793/201703/1127793-20170322203852002-166874541.pnghttps://images2015.cnblogs.com/blog/1127793/201703/1127793-20170322203904924-515174079.pnghttps://images2015.cnblogs.com/blog/1127793/201703/1127793-20170322203916065-306384900.png
  要求输入用户名,密码
https://images2015.cnblogs.com/blog/1127793/201703/1127793-20170322203632768-1615358625.png
  成功推入github~~加油加油
https://images2015.cnblogs.com/blog/1127793/201703/1127793-20170322203925674-1045500479.png
  补充:
  将仓库中的改动同步到本地
  在git-bash中进入项目目录下,使用git pull命令
  本地有更新,上传到github仓库:
  1、(先进入项目文件夹)通过命令 git init 把这个目录变成git可以管理的仓库
  

git init  

  2、把文件添加到版本库中,使用命令 git add .添加到暂存区里面去,不要忘记后面的小数点“.”,意为添加文件夹下的所有文件
  

git add .  

  3、用命令 git commit告诉Git,把文件提交到仓库。引号内为提交说明
  

git commit -m 'first commit'  

  4、关联到远程库
  

git remote add origin 你的远程库地址  

  如:
  

git remote add origin https://github.com/cade8800/ionic-demo.git  

  5、获取远程库与本地同步合并(如果远程库不为空必须做这一步,否则后面的提交会失败)
  

git pull --rebase origin master  

  6、把本地库的内容推送到远程,使用 git push命令,实际上是把当前分支master推送到远程。执行此命令后会要求输入用户名、密码,验证通过后即开始上传。
  

git push -u origin master  

  *、状态查询命令
  

git status  
页: [1]
查看完整版本: 【Git】本地与GitHub同步