如何使用git创建远程仓库(供局域网多人使用)
2016-04-11 10:28
645 查看
用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'.
因此在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'.
相关文章推荐
- V$RECOVERY_PROGRESS
- lintcode:Ugly Number I
- EF性能之关联加载
- 极限安全新闻播报(04.10
- Android ImageView去掉周围的白边
- jQuery获取多种值的方法
- T-SQL 高级查询
- 《网络工程师》 Part2 数据通信
- Java ActiveMQ连接池使用
- Unable to load configuration. - action - file:/E:/server/apache-tomcat-7.0.57/webapps/20160411Struts
- jQuery获取多种值的方法
- 解释 什么叫工作
- redis 的各种介绍
- php常用字符串函数
- php特殊类型
- apache日志文件处理成sqlite数据库
- 中国域名商域名注册保有量28强:美橙互联夺回第八
- 转载---Cookie/Session机制详解
- java反射原理
- 潜心悟道,升级人生