简体   繁体   English

如何将存储库推送到计算机和在线服务器?

[英]How can I push a repository to my computer and my online server?

I have figured out how to create a repository on github. 我已经弄清楚了如何在github上创建一个仓库。 Now I am trying to push the repository to both my macbook pro and my server, which is hosted through http://namecheap.com , and be able to understand how to keep things simple. 现在,我试图将存储库同时推送到通过http://namecheap.com托管的macbook pro和服务器上,并且能够理解如何使事情保持简单。 I am using wordpress on my server and I have a template theme. 我在服务器上使用wordpress,并且有一个模板主题。 I want to edit my files on my mac and then push them to the website, keeping everything easy. 我想在Mac上编辑文件,然后将其推送到网站,使一切变得简单。

There is plenty of information out there on how to get started with github, so I will just focus on clearing up a misconception: 有大量的信息在那里如何开始与GitHub的开始,所以我将只专注于清理一种误解:

Now I am trying to push the repository to both my macbook pro and my server 现在,我试图将存储库推送到我的Macbook Pro和服务器上

You do not push from github to a server. 您不从github push送到服务器。 You need to clone your github repo to your development (macbook) and production (server) environments. 您需要将github存储clone到开发(macbook)和生产(服务器)环境。

git clone https://github.com/USERNAME/REPOSITORY.git

https://help.github.com/articles/fetching-a-remote/ https://help.github.com/articles/fetching-a-remote/

Alternatively, you can push existing code to an empty repository by initializing locally, setting your remote and then pushing 另外,您可以通过以下方式将现有代码推送到空存储库中:在本地进行初始化,设置您的远程服务器,然后推送

git init
git add -A
git commit -m "Initial commit"
git remote add origin https://github.com/USERNAME/REPOSITORY.git
git push origin master

Once you have your repo setup, your typical workflow will look something like this: 完成回购设置后,典型的工作流程将如下所示:

  • Make changes in your development environment (macbook). 在您的开发环境(macbook)中进行更改。
  • push those changes to github. push这些更改push送到github。
  • pull those changes from github in your production or staging environment (server). pull从GitHub在生产或登台环境(服务器)的变化。

One of the main things you need to use git this way is access to a terminal on the hosting serve, to push your files directly through git that should be installed as well. 使用git的主要需求之一是访问托管服务上的终端,以直接通过应同时安装的git推送文件。

Alternatively you can upload file using any available protocol such as (s)FTP or SSH direct to your server. 或者,您可以使用任何可用协议(例如,FTP或SSH)将文件直接上传到服务器。 In this case you'll be using git to version and manager your templates but not to upload or release them. 在这种情况下,您将使用git来对模板进行版本控制和管理,而不是上载或发布它们。

I've seen that cheapnames.com provides Softaculous as a mechanism to manage their servers. 我已经看到,cheapnames.com将Softaculous作为一种管理服务器的机制。 This software also provides synch and install scripts. 该软件还提供同步和安装脚本。

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

相关问题 如何在服务器上自动下载Wordpress? - How can I download Wordpress on my server automatically? 在 WordPress 中,我如何按下按钮并将所有当前访问者重定向到另一个页面? - In WordPress, how can I push a button and redirect all my current visitors to another page? 设置我由XAMPP中的在线服务器提供商托管的网站 - Setting up my website I had hosted by an online server Provider in XAMPP 如何将WordPress网站移至我的计算机进行开发? - How to move a WordPress website to my computer for development? 如何修复我的MySQL服务器 - How do I fix my MySQL server 如何使用cPanel检查我的Web服务器中是否有mysqli? - How can I check if I have mysqli in my web server using cPanel? WordPress:在计算机上开发站点时如何使用域名? - WordPress: how do I use a domain name when developing a site on my computer? 如何从另一台计算机访问我在 XAMPP 上的 localhost WordPress 网站? - How do I access my localhost WordPress website on XAMPP from another computer? 如何在Wordpress中包含一个PHP文件,该文件不在我的主题中,而是在同一台服务器上? - How can I include a PHP file in Wordpress that is outside of my theme but on the same server? 如何从服务器上的 php 脚本获取 php 脚本的 echo 输出? - How can I get the echo output of a php script from a php script on my server?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM