How to use git locally and push to remote server

前端 未结 2 1435
-上瘾入骨i
-上瘾入骨i 2020-12-10 10:11

I want to use git to manage my development, integration test and production environments. I\'ve looked around but can\'t seem to find a simple explanation of how (eg Git -

2条回答
  •  情歌与酒
    2020-12-10 10:20

    If you have ssh connection to the server, you can add a git remote directly to the repository on the server. Something like:

    git add remote production sshUser@example.com:/path/to/repo/.git
    

    Then, to deploy,

    git push production branch
    

    That said, you probably shouldn't have your production code served from a git repository. Much better is to set up a repository outside your web root and use a post-receive hook to copy the code to the web root. This appears to be outlined here: Deploy a project using Git push

提交回复
热议问题