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'.

  • 相关阅读:
    C# -- 使用缓冲区进行文件下载操作
    C# -- 使用ODBC连接数据库
    C# -- Quartz.Net入门案例
    C# -- LinkedList的使用
    ASP.NET -- 获取浏览器信息
    Windows -- 从注册表删除IE浏览器加载项
    C# -- FTP上传下载
    C# -- 使用Ping检查网络是否正常
    WinForm -- 为TextBox文本框添加鼠标右键菜单
    C# -- 使用Parallel并行执行任务
  • 原文地址:https://www.cnblogs.com/welhzh/p/5377358.html
Copyright © 2011-2022 走看看