您的位置:首页 > 其它

SourceTree环境的搭建

2015-10-22 15:59 281 查看
在mac os x上搭建sourceTree的版本控制环境,花了不少时间,仍有许多疑惑,现将自己现在知道的记录一下。

1.创建一个新的git 服务器库,让同事们可以共享代码。具体搭建步骤按照“Git详解”系列文档进行。因为老大没有给我放开所有的权限,故我没有办法设置ssh、http以及git协议。但NFS可以帮助我创建一个新的库。

(1).打开sourceTree,创建本地仓库。不过本地路径你需要通过nfs选择服务器的存储路径。

(2).创建好新的裸仓库,再将服务器的git仓库克隆到本地的工作目录。

(3).接下来可以将代码拷贝到工作目录了,然后就是commit。在提交的过程中,我遇到如下问题:

*提交的时候需要提供“全名”和“邮箱信息”,试了好几个都不是,有点晕,上网查询了下也没用,结果在设置里看到了用户和邮箱的信息。

并且需要取消勾选“使用所有仓库的这些细节”。



(4).能够提交了,但是又出现如下错误“[remote rejected] master -> master (branch is currently checked out)”

错误原型如下:

remote: error: 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 rejected] master -> master (branch is currently checked out)
。。。。。。
error: failed to push some refs to 'git@192.168.1.X:/var/git.server/.../web'

百度了下,有网友遇到过这个问题,原来是因为git默认拒绝了push操作,需要进行设置,修改.git/config文件后面添加如下代码:结果终于成功提交,并且从其他电脑成功克隆到本地。
[receive]

denyCurrentBranch = ignore

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: