美文网首页
coding仓库与本地工程建立联系

coding仓库与本地工程建立联系

作者: 突刺刺 | 来源:发表于2017-12-22 18:52 被阅读135次

    1.前提:已经建立远程coding仓库

    coding建立仓库

    2.git命令行的正常使用

    1.远程仓库coding克隆到本地

         cd /Users/yourMacName/Desktop/新建文件
         git clone https://coding.net/yourusername/projectname.git 
    

    2.本地仓库添加文件,并提交到远程仓库

          git add yourfile
          git commit -m'your message'
          git push
    
    3.远程仓库有更新,同步到本地仓库
          git pull
    
    4.删除远程仓库文件(远程仓库与本地仓库已经建立关联)
          git rm your file
          git commit -m'delete yourfile'
          git push
    
    5.注意:以上的方法,会把远程仓库的最外层文件夹带来,产生的路径如下
          /Users/yourMacName/Desktop/新建文件/yourProjectFiles/yourfile
    

    3.不带仓库最外层的文件夹(图1和图2的区别)

    图1 图2
    1.初始化本地git仓库
         git init
        rm -rf .git//删除git init
    
    2.关联远程仓库

    方法1:直接替换远程仓库连接

         cd /Users/yourMacName/Desktop/测试版
         git remote set-oldURL origin <newURL> 
    

    方法2:先删后加

         cd /Users/yourMacName/Desktop/测试版
         git remote rm origin 
         git remote add origin https://coding.net/yourProject/test
    

    方法3:修改config文件

         cd /Users/yourMacName/Desktop/测试版
         git remote -v:显示当前所有远程库的详细信息
         git config -e
    
    3.push,pull,delete操作
         git add yourfile
         git commit -m'your message'
         git push
    
         git rm yourfile
         git commit -m'delete yourfile'
         git push
     
         git pull
    
    4.其他命令行
          git config --global user.name 'your Name'
          git config --global user.email 'your Email'
          git config --list //查看config
          git config --global --replace-all user.email "输入你的邮箱"//修改email/name/password
    
    fatal: The current branch master has no upstream branch.
    To push the current branch and set the remote as upstream, use
     
    git push --set-upstream origin master
    
    //使用git在本地新建一个分支后,需要做远程分支关联。如果没有关联,git会在下面的操作中提示你显示的添加关联
    //解决办法 已经在上面提示出来了
    
          git push --set-upstream yourGit
    

    svn/git提交的状态解决(出现?!~字符)
    终端命令行使用svn

    相关文章

      网友评论

          本文标题:coding仓库与本地工程建立联系

          本文链接:https://www.haomeiwen.com/subject/hcuxgxtx.html