zoukankan      html  css  js  c++  java
  • 如何使用git创建远程仓库(供局域网多人使用)

    用git init(默认创建的是私人的仓库)创建的仓库,推送是不会成功的。

    因此在git server端,我们要用 git --bare init --shared=group 来创建一个bare库,意思是创建一个共享的多人合作的仓库,这样则可以往新建的远程仓库中推送更新。

    在git client 端,可以用如下命令对远程仓库进行跟踪:

    git clone ssh://192.168.100.103/~/jj/.git

    在有改动的情况下,可以使用:

    git push origin master,   将本地master分支push到远端的master分支

    注意,远程仓库必须是bare库,若为非bare库,则不能提交,会提示:

    refusing to update checked out branch: refs/heads/master
    remote: error: By default, updating the current branch in a non-bare repository
    remote: error: is denied, because it will make the index and work tree inconsistent
    remote: error: with what you pushed, and will require 'git reset --hard' to match
    remote: error: the work tree to HEAD.
    remote: error:
    remote: error: You can set 'receive.denyCurrentBranch' configuration variable to
    remote: error: 'ignore' or 'warn' in the remote repository to allow pushing into
    remote: error: its current branch; however, this is not recommended unless you
    remote: error: arranged to update its work tree to match what you pushed in some
    remote: error: other way.
    remote: error:
    remote: error: To squelch this message and still keep the default behaviour, set
    remote: error: 'receive.denyCurrentBranch' configuration variable to 'refuse'.

  • 相关阅读:
    ps:点阵格式图像
    ps:图像尺寸
    ps:HSB色彩模式
    git上传文件夹的问题
    sublime下载emmet
    git Octotree:提供项目目录,方便用户在线快速浏览项目结构【转载】
    git@github.com出现Permission denied (publickey)
    less:避免编译
    less:@arguments变量
    less嵌套规则
  • 原文地址:https://www.cnblogs.com/welhzh/p/5377358.html
Copyright © 2011-2022 走看看