【问题标题】:Create bare repo with work tree from already existing files使用现有文件的工作树创建裸仓库
【发布时间】:2012-06-27 02:28:42
【问题描述】:

我的远程服务器上有一个已经在工作的非 git 目录 (/var/www/site1),我使用 ftp 对其进行了更改,但我想使用 git。所以这就是我所做的:

cd ~/git/site1.git
git init --bare
cat > hooks/post-receive
#!/bin/sh
GIT_WORK_TREE=/var/www/site1 git checkout -f
$ chmod +x hooks/post-receive

如何将文件添加到 git 存储库,以便将文件拉到本地目录?我试过了:

git remote add ssh://root@remote:3756/git/site1.git site1
git pull site1 +master:refs/heads/master
fatal: Couldn't find remote ref master

我也试过了:

git clone ssh://root@remote:3756/git/site1.git site1
Cloning into 'site1'...
warning: You appear to have cloned an empty repository.

我正在关注本教程:http://toroid.org/ams/git-website-howto

【问题讨论】:

    标签: git deployment ssh


    【解决方案1】:

    将文件下载到您的计算机,克隆存储库,将文件复制到存储库文件夹,提交文件,然后推送到服务器。但是,如果您要使用 git 将文件上传到网站,请不要使用它,因为这些文件不是直接可见的。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2019-06-19
      • 2017-02-14
      • 2013-05-09
      • 1970-01-01
      • 2019-07-15
      • 1970-01-01
      • 2022-12-21
      • 2018-08-26
      相关资源
      最近更新 更多