git push

  1. 将本地分支的修改提交到远程分支上面
  2. 先git branch -a
    yyy@koridy-251:~/D92/pizza$ git branch
    • D92
      i8
      master
  3. 查看与远程分支的关联信息
    vim .git/config
    [core]
    repositoryformatversion = 0
    filemode = true
    bare = false
    logallrefupdates = true
    [remote “origin”]
    fetch = +refs/heads/:refs/remotes/origin/
    url = ssh://xxx@192.168.100.50/git/H20/pizza.git
    [branch “master”]
    remote = origin
    merge = refs/heads/master
    [branch “i8”]
    remote = origin
    merge = refs/heads/i8
    注意:如果远程主机IP不对,会导致连接上不

  4. git push

    1. 将各个branch 同步到origin上面,现在本地有D92, I8,这两个分支同步到远程服务器上面
      shuliwu@koridy-251:~/D92/pizza$ git push
      Counting objects: 174, done.
      Delta compression using up to 8 threads.
      Compressing objects: 100% (72/72), done.
      Writing objects: 100% (98/98), 1.23 MiB, done.
      Total 98 (delta 74), reused 21 (delta 19)
      To ssh://xxx@192.168.100.50/git/H20/pizza.git
      e3cf46d..8e9a950 D92 -> D92
      ! [rejected] i8 -> i8 (non-fast-forward)
      error: failed to push some refs to ‘ssh://xxx@192.168.100.50/git/H20/pizza.git’
      To prevent you from losing history, non-fast-forward updates were rejected
      Merge the remote changes (e.g. ‘git pull’) before pushing again. See the
      ‘Note about fast-forwards’ section of ‘git push –help’ for details.

说明:
1. e3cf46d..8e9a950 D92 -> D92 ,D92同步成功
2. ! [rejected] i8 -> i8 (non-fast-forward) ,I8没有成功

我们现在只关心D92所以到此步已经OK

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值