linux - 在 nodejs 的部署服务器上初始化 git

标签 linux git node.js ubuntu

我想用 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/

相关文章:

javascript - 客户端应该使用http post还是socket.io将文件上传到我的nodejs服务器?

linux - 如何应用压缩补丁?

linux - 错误 : Named volume "xplore:/root/xPlore/rtdata:rw" is used in service "dsearch" but no declaration was found in the volumes section

c - listen() 忽略积压参数?

Git 错误 : conq: repository does not exist

linux - 从 git 树中 check out

通过 HTTPS 进行的 Git 克隆在 Docker makefile 中不起作用

node.js - 如何使用 Hapi.js Lab 测试框架在控制台进行调试?

linux - 海绵和T恤的区别

mysql - 使用nodeJS保持用户登录