简体   繁体   English

推送到远程 git 服务器

[英]Pushing to remote git server

I setup an Ubuntu server with openssh and git, nothing else is on there.我用 openssh 和 git 设置了一个 Ubuntu 服务器,那里没有其他东西。 It is a VM on my LAN.它是我局域网上的虚拟机。 I created a dir under home dir called sites, in there is my main site where I want to push to.我在主目录下创建了一个名为站点的目录,在我想要推送到的主站点中。 Ran these commands:运行这些命令:

mkdir -p mysite.git
cd mysite.git
git init --bare

Then from my workstation I ran:然后从我的工作站运行:

git remote add origin steve@10.0.0.15:sites/mysite.git
git push origin master

It seemed to push it with no errors, however when I browse the dirs on the git server I can't locate any of the files.它似乎没有错误地推送它,但是当我浏览 git 服务器上的目录时,我找不到任何文件。 Am I missing something?我错过了什么吗?

Not exactly the same question, but very similar answer: Git bare repository doesnt reflect changes made from push不完全相同的问题,但非常相似的答案: Git 裸存储库不反映推送所做的更改

TLDR: bare repositories have no files to browse (those repositories don't have a working copy) TLDR: bare存储库没有可供浏览的文件(这些存储库没有工作副本)

Create a normal git repo and search for how to automatically pull after changes are pushed.创建一个普通的git repo 并搜索如何在推送更改后自动拉取。

Yes, you can push to any git repository, not only bare ones.是的,您可以推送到任何 git 存储库,而不仅仅是裸存储库。


Edit: Maybe check this answer for inspiration: https://stackoverflow.com/a/1434230/1988796编辑:也许检查这个答案以获得灵感: https : //stackoverflow.com/a/1434230/1988796

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM