Jump to content

Deploying with Git


Drongo_III

Recommended Posts

Hello

 

I want to deploy an application hosted on Git Hub.  It's my first time doing it this way. ()

 

I've cloned the application on my web server and everything works great.  I've done some additional changes locally and pushed them up to Git Hub along with a tag (called testTag).  I understand tags are common practice to mark a release point.

 

The bit I'm confused by is how I deploy that specific tag to my server?  I want to be able to checkout the tag to my server's master branch but when I checkout the tag (code below), it kicks me off the branch. Not what I was hoping for.

git fetch --all --tags --prune
git checkout testTag

Any advice appreciated!  And I know this isn't strictly PHP but I couldn't see a forum relevant to this. If it's any consolation it is a PHP application I'm trying to deploy  :tease-01:

 

Drongo

Link to comment
Share on other sites

I won't claim to know how to do it professionally ("continuous integration" is what that's called) but

 

Yes, tags can mark releases, but it's easier to deploy with a branch: make one just for released code and merge into it when you're ready. You can then put your tags on that, but deployment would be just checking out the new code. You can even stick the fetch+checkout commands in a cronjob.

 

Make sure you don't have the .git directory in the web root - really, you should have everything set up like that to begin with anyways, with source code separate from the web-accessible files and whatnot.

 

And another thing: do a detached checkout from origin instead of creating local branches.

git checkout --detach origin/release
(if "release" is the name of the release branch)

 

One more thing. If you go automated, be damn sure you have great testing in place first.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.