【问题标题】:Is it possible to use one git repo and run two sites from two different branches?是否可以使用一个 git repo 并从两个不同的分支运行两个站点?
【发布时间】:2020-09-15 04:31:10
【问题描述】:

我有一个项目,我为它设置了一个 git 存储库。我有两个与我合作的分支:主分支和开发分支。这都是在我的服务器上设置的。我想做的是从子域访问和测试我的开发分支,当一切正常时,合并到运行主站点的主站点。例如:

主分支:example.com

开发分支:dev.example.com

这可能吗?我的网站是一个在 Node 上运行的 Express 应用程序,我在 Ubuntu 20.04 服务器上使用 Nginx,主域和子域位于不同的服务器块上。任何正确方向的帮助或指示将不胜感激。

【问题讨论】:

  • 否,因为您只能从文件系统运行站点。 Checkout 是来自 git 的文件系统操作,不能在两个不同的分支上。

标签: git nginx subdomain production


【解决方案1】:

是的,这很有可能。请参阅下面的 cmd。

$ cd /tmp
$ mkdir abc
$ cd abc
$ git init
Initialized empty Git repository in /tmp/abc/.git/
$ echo testing > README
$ git add README
$ git commit -m 'first commit'
[master (root-commit) e675a97] first commit
 1 file changed, 1 insertion(+)
 create mode 100644 README
$ cd ..
$ git clone abc def
Cloning into 'def'...
done.
$ cd def
$ ls
README
$ 

参考:https://www.reddit.com/r/git/comments/5giehg/is_it_possible_to_have_a_remote_thats_on_the_same/

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2011-11-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-04-06
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多