zoukankan      html  css  js  c++  java
  • git命令

    远程仓库

    由于你的本地Git仓库和GitHub仓库之间的传输是通过SSH加密的,所以,需要一点设置:创建SSH Key:https://www.liaoxuefeng.com/wiki/0013739516305929606dd18361248578c67b8067c8c017b000/001374385852170d9c7adf13c30429b9660d0eb689dd43a000

    $ ssh-keygen -t rsa -C "youremail@example.com"
    $ git add readme.txt 
    $ git commit -m "branch test"
    
    创建dev分支,然后切换到dev分支:
    	$ git checkout -b dev
    	Switched to a new branch 'dev'
    用git branch命令查看当前分支:
    	$ git branch
    	* dev
    	  master
    	  
    	 
    	 
    关联远程库
    	 $ git remote add origin git@github.com:michaelliao/learngit.git
    
    $ git push -u origin master
    Counting objects: 20, done.
    Delta compression using up to 4 threads.
    Compressing objects: 100% (15/15), done.
    Writing objects: 100% (20/20), 1.64 KiB | 560.00 KiB/s, done.
    Total 20 (delta 5), reused 0 (delta 0)
    remote: Resolving deltas: 100% (5/5), done.
    To github.com:michaelliao/learngit.git
     * [new branch]      master -> master
    Branch 'master' set up to track remote branch 'master' from 'origin'.
    
    
    报错:
    F:game_project
    ode_project>git push -u origin master
    To https://gitee.com/cn_xxxxx/node.git
     ! [rejected]        master -> master (fetch first)
    error: failed to push some refs to 'https://gitee.com/cn_xxxxx/node.git'
    hint: Updates were rejected because the remote contains work that you do
    hint: not have locally. This is usually caused by another repository pushing
    hint: to the same ref. You may want to first integrate the remote changes
    hint: (e.g., 'git pull ...') before pushing again.
    hint: See the 'Note about fast-forwards' in 'git push --help' for details.
    解决:
    1、先拉下来,会自动合并的(不用操心)
    	git pull origin master
    
    2、再上传
    	git push -u origin master
    

      

  • 相关阅读:
    不同编码字符所占大小
    期末考点总结--------多元统计分析
    博客网站设计
    java 事件举例
    zookerper总结
    Spring java配置
    Sense and Sensibility
    栈的出栈序列个数
    闭算子
    线性空间结论总结
  • 原文地址:https://www.cnblogs.com/dengrenning/p/9650668.html
Copyright © 2011-2022 走看看