git上传项目到远程github服务器与远程仓库克隆到本地

git上传项目到远程github服务器与远程仓库克隆到本地



  • 常用命令:

    • 一、本地仓库同步到github:
      • 1.1 git remote add [files_name] [url]
        使用git remote -v可查看远程仓库。git上传项目到远程github服务器与远程仓库克隆到本地
        fetch: 远端仓库拉到本地;push: 本地推到远端。
        报错:
        git上传项目到远程github服务器与远程仓库克隆到本地
        原因: 本地仓库与远端仓库不一样,远端包含某些东西,本地是没有的。
        解决方法: 将远端仓库先fetch下来,合并分支,再push。

        git上传项目到远程github服务器与远程仓库克隆到本地git上传项目到远程github服务器与远程仓库克隆到本地
        这里拒绝了我们的合并要求,这时候使用 git merge -h查看命令帮助,里面提示我们使用git merge --allow-unrelated-histories Mxshop/master就可以合并。

        git上传项目到远程github服务器与远程仓库克隆到本地

      • 成功推到远端github
        git上传项目到远程github服务器与远程仓库克隆到本地
        查看命令帮助: git 【】 -h

      • 开发之前,都应该做git pull。

        • 作用:将远端仓库同步到本地,本地同步到远端。


  • 二、远程仓库克隆到本地:
    • 2.1 语法

      git clone [url]
      
    • 2.1 实例

       $ git clone [email protected]:Alextaotao/git_learning.git