用git将本地文件上传到远程仓库(git push)

2019-07-05  本文已影响0人  赫尔特
  1. 密钥生成:https://blog.csdn.net/qq_34446663/article/details/81106018
  2. 本地仓库连接到远程仓库:https://www.cnblogs.com/fnng/archive/2011/08/25/2153807.html
  3. 按照上面的方法,在第二次提交时,可能会遇到“nothing to commit, working tree clean”的报错,原因是你的项目没有进行修改,git认为没有必要提交,你可以尝试打开之前提交的文件,修改里面的一些内容,这个时候就可以提交了。
  4. 比如:(2中网址实例)
    makdir ~/hello-world //创建一个项目hello-world cd ~/hello-world //打开这个项目
    git init //初始化 touch README
    git add README //更新README文件 git commit -m 'first commit'//提交更新,并注释信息“first commit”
    git remote add origin git@github.com:xuezhixiaxuenai/nainaitianwaixian.git //连接远程github项目 git pull origin master --allow-unrelated-histories //将分支强行合并
    $ git push -u origin master //将本地项目更新到github项目上去
上一篇 下一篇

猜你喜欢

热点阅读