我的远程服务器上有一个已经在工作的非 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 repo 以便我可以将文件拉到本地目录?我试过:
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.