如何使用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'.
如何使用git创建远程仓库(供局域网多人使用)的更多相关文章
- 为git创建远程仓库
首先生成ssh公钥: 将公钥添加到git: 测试秘钥是否通过: 然后就可以到web界面看到标注的地方被绿了: 但是我的没有绿,不知道为啥,难道没有女朋友的原因吗? rm -rf .ssh 重来好几遍都 ...
- Git 创建远程仓库并克隆到本地,创建本地仓库并推送到远程仓库
配置用户信息 配置的是你个人的用户名称和电子邮件地址.这两条配置很重要,每次 Git 提交时都会引用这两条信息,说明是谁提交了更新,会随更新内容一起被永久纳入历史记录 git config --glo ...
- git 创建远程仓库
在远程服务器上$ cd /server/path/ $ git init --bare myproject.git 在本地 1> $ cd /client/path/ 运行 git init 2 ...
- 和同事合作开发,使用局域网 git创建本地仓库
转自原文 和同事合作开发,使用局域网 git创建本地仓库 1.仓库 建一个空文件夹来做仓库,例如建为 cangku 1.1 cd 到 cangku目录下 创建远程仓库容器 mkdir mycangk ...
- git在本地创建远程仓库
类似的博文,在前面的帖子里面也提到过,当时讲述的是一个入门级别的.其URL是ssh://username@repo-host-address/repo-path这种格式. 今天再说说如何创建类似Git ...
- git的使用(包括创建远程仓库到上传代码到git的详细步骤以及git的一些常用命令)
A创建远程仓库到上传代码到git 1)登陆或这注册git账号 https://github.com 2)创建远程仓库 3)打开终端输入命令 cd到你的本地项目根目录下,执行如下git命令 git in ...
- Git学习 -- 远程仓库
第1步:创建SSH Key 在用户目录下的.ssh目录中,查看是否有id_rsa和id_rsa.pub两个文件,若没有则通过以下命令生成秘钥对: $ ssh-keygen -t rsa 第2步:登陆G ...
- github创建远程仓库
创建远程仓库 当你已经在本地创建了一个Git仓库后,又想在GitHub创建一个Git仓库,并且让这两个仓库进行远程同步,这样,GitHub上的仓库既可以作为备份,又可以让其他人通过该仓库来协作,真是一 ...
- Git从远程仓库里拉取一条本地不存在的分支方法
Git从远程仓库里拉取一条本地不存在的分支方法 从远程仓库里拉取一条本地不存在的分支时,进入到对应目录先执行git fetch然后再执行git checkout -b 本地分支名 origin/远程分 ...
随机推荐
- 完美配置Tomcat的HTTPS
Tomcat配置HTTPS的文章到处都有,过程也比较简单,随后文中会转一段过来. 但对于启用APR情况下报异常“java.lang.Exception: Connector attribute SSL ...
- json格式的字符串转为json对象遇到特殊字符问题解决
中午做后台发过来的json的时候转为对象,可是有几条数据一直出不来,检查发现json里包含了换行符,造成这种情况的原因可能是编辑部门在编辑的时候打的回车造成的 假设有这样一段json格式的字符串 va ...
- 【转载】React入门-Todolist制作学习
我直接看的这个React TodoList的例子(非常好!): http://www.reqianduan.com/2297.html 文中示例的代码访问路径:http://127.0.0.1:708 ...
- poj 1061 青蛙的约会(扩展gcd)
题目链接 题意:两只青蛙从数轴正方向跑,给出各自所在位置, 和数轴长度,和各自一次跳跃的步数,问最少多少步能相遇. 分析:(x+m*t) - (y+n*t) = p * L;(t是跳的次数,L是a青蛙 ...
- dp,px转换
public static int dip2px(Context context, float dpValue) { final float scale = context.getRes ...
- 函数buf_page_init_for_read
/********************************************************************//** Function which inits a pag ...
- 关于fft的一点总结
好吧,其实我并没有深入运用fft,只会优化卷积 听说fft经常和生成函数结合在一起………………oi真是迅猛发展,我真是与时代脱节了…… 关于fft的学习推荐直接去看算法导论,写得非常清楚 主要弄懂n次 ...
- Asp.Net生成RSS方法
一.RSS简介 什么是RSS? RSS是一种网页内容联合格式(web content sydication format). 它的名字是Really Simple Syndication的缩写. RS ...
- oracle 11g rac 无法自动启动
如果以上的操作依然不能使数据库资源自动启动,那么参考下面这篇文章修改资源AUTO_START属性. 查看资源状态: crsctl status resource 资源 -p crs ...
- Android异常之 unable to write jarlist cache file
异常: android开发调试时候不能运行,出现 unable to write jarlist cache file 错误. 解决方法: 1.找到appcompt文件夹如下的位置.