2011-02-04 54 views
1

好吧,我在我的机器上安装了一个repo安装程序,我正在使用它来将更新推送到文件服务器上的某个位置。我用下面的克隆:使用GIT更新本地文件服务器上的文件

机器上的dir开始:

git init 
git add . 
git commit -m 'initial' 
cd ../ 

然后克隆到文件服务器

git clone -bare testdir fileserverip/testdir 

此克隆很好,但我该如何使用GIT更新?与我以前使用GIT的经验不同,我不想通过SSH或其他方式进行连接,因此如何设置推送?

编辑:

的Makis在答复中提到修改我的设置后,我得到git push

james-macbook:test2 james$ git push 
Counting objects: 6, done. 
Delta compression using up to 2 threads. 
Compressing objects: 100% (4/4), done. 
Writing objects: 100% (4/4), 506 bytes, done. 
Total 4 (delta 1), reused 0 (delta 0) 
Unpacking objects: 100% (4/4), done. 
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: 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'. 
To xxxxxxxxxxxxxxxxxxx 
! [remote rejected] master -> master (branch is currently checked out) 
error: failed to push some refs to 'xxxxxxxxxxxxxxxxxxx' 
james-macbook:test2 james$ 

任何人以下错误知道这意味着什么?

编辑:刚发现这个,认为这是我所需要的。 http://tiredblogger.wordpress.com/2009/11/09/creating-local-git-repositories-yeah-its-that-simple/

感谢

+0

只是认为这可能更适合ServerFault。不确定? – 2011-02-04 15:37:45

+0

这个问题看起来像你的远程回购不光。 – Makis 2011-02-04 17:33:45

回答

1

如果你可以挂载通过NFS或桑巴,易peasy服务器目录。我会先在服务器上创建裸仓库。然后克隆机器上的空存储库并添加东西。

之后,一切正常(拉,推)。

+0

嘿谢谢,我会给你一个去。 – 2011-02-04 15:42:10

0

这听起来像是你试图做一些非常类似于推送到git存储库部署网站的常见问题的东西,所以关于如何做到这一点的信息应同样适用于这种情况。

http://toroid.org/ams/git-website-howto

该网页介绍了设定纯仓库(FYI在命令你上面列出你有-bare代替--bare这可能是您所遇到的一个问题),并使用后收到钩来更新目录的内容自动。 post-receive hook通过调用git checkout -f来完成此操作,但是指定了一个明确的工作树(裸存储库没有工作树,因此通常命令会失败)。

相关问题