简体   繁体   English

Git通过有限的SSH推送到实时服务器

[英]Git push to live server through limited ssh

I'm using GitHub to keep track of my source code. 我正在使用GitHub跟踪源代码。 Although I work alone, it comes really handy to test new features and rollback if it doesn't work. 尽管我一个人工作,但是如果不起作用,测试新功能和回滚确实非常方便。 So, I installed in Git Bash in my windows machine, and commit & push to github when the code is ready. 因此,我将其安装在Windows机器的Git Bash中,并在代码准备就绪时提交并推送到github。

Now, I want to take this further and deploy from the same terminal. 现在,我想更进一步,并从同一终端进行部署。 My shared-hosting has SSH access but is kinda limited. 我的共享主机具有SSH访问权限,但有一定限制。 They told me they had Git, but only as a client, to read repos. 他们告诉我他们只有Git,但只有Git可以阅读回购协议。 I don't know what that means. 我不知道那是什么意思

I was trying to make a repo on the live server, add it as remote on my machine and then just 'git push remote live' but that didn't work. 我试图在实时服务器上创建一个存储库,将其添加为我的计算机上的远程服务器,然后只是“ git push remote live”,但这没有用。

Whenever I type 'git init' on the live server it returns: 每当我在实时服务器上键入“ git init”时,它都会返回:

warning: templates not found /usr/share//git-core/templates/

Initialized empty Git repository in /www/example.com.ar/htdocs/example.com.ar/.git/

And I can't 'git clone' or 'git pull' or anything! 而且我不能'git clone'或'git pull'或其他任何东西!

Is there any tips you can give me? 您有什么建议可以给我吗? I'm just tired of drag&dropping my folder via FTP, it just feels so wrong! 我只是厌倦了通过FTP拖放文件夹,感觉真不对劲!

Thanks in advance 提前致谢

GitHub is the git server GitHub是git服务器

Both you and your hosting will simply act as clients. 您和您的主机都将仅充当客户端。

all you need to do (if git is properly installed) log into your ssh session. 您需要执行的所有操作(如果正确安装了git)登录到ssh会话。

type the following into the terminal 在终端中输入以下内容

git clone git://github.com/<username>/<name of repo>.git folder_name

to clone that git repo into folder_name 将该git repo克隆到folder_name

to get updates you have pushed to the live server, you need to again, log into ssh and git pull 要获得推送到实时服务器的更新,您需要再次登录ssh和git pull

There is a git server that'll handle incoming git requests so you don't need to access it via SSH. 有一个git服务器将处理传入的git请求,因此您不需要通过SSH访问它。 It's not very popular (relative to just the client) and you don't need it. 它不是很流行(仅相对于客户端),您不需要它。 The git client should be all you need. git客户应该是您所需要的。 It sounds like there is something else wrong with their install. 听起来他们的安装还有其他问题。

Perhaps someone else can chime in here and get git working in this limited environment for you, but when there are so many dirt cheap and really flexible hosts out there it's probably much easier to switch to one of them and solve a whole gamut of problems all in one. 也许其他人可以在这里编排钟声,让git在这个有限的环境中为您工作,但是当那里有这么多便宜又真正灵活的主机时,切换到其中一个主机并解决全部问题可能要容易得多合二为一。

Dreamhost, MediaTemple, RackspaceCloud, Slicehost, and (of course) Amazon EC2 are just a few of solid hosting services worth checking out. Dreamhost,MediaTemple,RackspaceCloud,Slicehost和(当然)Amazon EC2只是一些值得检查的可靠托管服务。

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

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