我通过ssh创建了一个git存储库。它有效,但我在目录中看不到文件。

远程(ssh):

mkdir test.com
cd test.com
git init

client(git bash)
cd /apache/htdocs
git clone git://myserverip/test.com
cd test.com
git add --all .
git commit -a -m "first"
git push origin master

最佳答案

我认为,您必须添加文件并在服务器上的存储库中提交。为什么不尝试裸仓库?

如果您需要通过远程推送提交,请尝试以下命令:

在服务器上创建存储库:

cd /usr/local/git/    ## or your own repo destination
mkdir repo.git
cd repo.git
git init
touch README
git add .
git commit -a -m "start my repository"

在诸如ubuntu的客户端上:
git clone ssh://User@serverip:sshport/usr/local/git/repo.git myrepo
cd myrepo
git branch someUser   # create new branch
vim README   ## some change on the file
git add README
git commit -a -m "some change by someUser"    ## user commit changes
git push origin someUser   ## push commit to server

用户推送更改的系统管理员必须是合并提交后,简单的方法是:
cd /usr/local/git/repo.git
git merge someUser   ##  merge repo by user commit

09-04 12:41
查看更多