我想用 nodejs 应用程序创建一个部署服务器。我将在我的 windows 机器上编写 nodejs 代码并将其推送到该 ubuntu linux 服务器上。你能告诉我应该如何设置 git 以将新代码推送到这个代码中吗?
最佳答案
在服务器上设置 git 的最简单方法是在服务器上创建空的裸 git 存储库:
mkdir -p path/to/git/repos/myproject.git
cd path/to/git/repos/myproject.git
git init --bare
现在,返回 Windows 框并设置 msysgit git command line客户或TortoiseGit通过 ssh 连接到你的 Linux 机器。
您的目标是从服务器成功克隆您的空存储库:
git clone ssh://username@server:/path/to/git/repos/myproject.git
完成后,你可以git add
你的内容到目录myproject
,然后git commit
,最后git push
。
关于linux - 在 nodejs 的部署服务器上初始化 git,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13527914/