- This topic is empty.
-
AuthorPosts
-
September 15, 2014 at 11:24 am #183122
nixnerd
ParticipantBut I’m assuming it would be more than that. I would actually have to install git, correct?
On your server? Yes. You would install it the same way you install any package:
sudo yum update sudo yum install git
September 15, 2014 at 11:30 am #183123chrisburton
ParticipantOk. I updated and installed git. Now do I
git clone
? Traq said create a directory but what if I want the repo to be added into my/var/www/html
directory?September 15, 2014 at 11:33 am #183124__
ParticipantRight. I know the very basics of SSH (logging in, starting/stopping/restarting apache/mysql, checking statuses and changing directories) and that’s it.
Actually, the only part of that that is “ssh” is connecting to your server. After that, it’s the same as working on your own terminal. It’s just connected to a different computer.
I just want my server to watch my repo and if there are changes, upload those changes to the server. I’m not sure what all that entails, whether I have install stuff just to give it a basic command to do this.
That’s the “hooks” thing. That’s what this tutorial explained.
September 15, 2014 at 11:36 am #183125chrisburton
ParticipantThat’s the “hooks” thing. That’s what this tutorial explained.
OK. A bit nervous to do this (don’t want to mess anything up — like last time). I’ll give that a shot.
September 15, 2014 at 11:40 am #183126__
Participantwhat if I want the repo to be added into my public_html directory?
cd to your public_html and do it there. The directory must be empty, however, or git will warn you.
On the server, I usually do one repo that is not live (a “staging” repo, as it were, for last-minute-pre-launch testing, and as a local backup), and then clone/pull the “live” site from that. You don’t have to do it that way, but I personally like it.
September 15, 2014 at 11:44 am #183127nixnerd
Participant@chrisburton BTW, you make a directory like this
mkdir nameofdirectory
September 15, 2014 at 11:48 am #183129chrisburton
ParticipantGit repositories have a folder called ‘hooks’. This folder contains some sample files for possible actions that you can hook and perform custom actions set by you.
Git documentation define three possible server hooks: ‘pre-receive’, ‘post-receive’ and ‘update’. ‘Pre-receive’ is executed as soon as the server receives a ‘push’, ‘update’ is similar but it executes once for each branch, and ‘post-receive’ is executed when a ‘push’ is completely finished and it’s the one we are interested in.
I believe post-receive is what I’m looking for?
September 15, 2014 at 11:53 am #183131__
Participantyesyes
September 15, 2014 at 12:57 pm #183148chrisburton
ParticipantJust an FYI, I’m reading the tutorial before I actually do it. For reasons like this:
If you scroll down to the Local Machine part, the author suggests to create a local repo….
** Local Machine
Let’s create our local repository. You should change the path and name to whichever you choose. If you are on a VPS, just type:exit
And create your repo:
cd /my/workspace mkdir project && cd project git init
But the thing is, I already have one setup when I started using Tower.
If you scroll further down from that it talks about committing changes with messages…
Let’s assume that we have some great work ready in this folder. We should do the usual steps of adding the files and commit with a message:
git add . git commit -m "My project is ready"
Just to remember, the dot after ‘git add’ means you are adding all files to stage. After ‘git commit’ we have ‘-m’ which means we will type a message. To complete, we just ‘push’ everything to the server. We use the ‘live’ alias that we used when setting the remote.
git push live master Counting objects: 7, done.Delta compression using up to 4 threads.Compressing objects: 100% (7/7), done.Writing objects: 100% (7/7), 10.56 KiB, done.Total 7 (delta 0), reused 0 (delta 0)To ssh://[email protected]/var/repo/site.git* [new branch] master -> master
Here we tell Git to push to the ‘live’ remote on the ‘master’ branch. To understand more about branches and how to use it you can read this tutorial.
Grr! Exactly what I wanted to stay away from on the command line. That’s what I have the Tower app for.
September 15, 2014 at 1:14 pm #183150nixnerd
ParticipantExactly what I wanted to stay away from on the command line.
Can I ask why exactly? I have found the command line to be the most powerful tool in all of computer science. It may seem awkward and first but I promise you… you will grow to prefer it. I literally don’t even use my traditional file manager anymore. VERY RARELY will I ever open it. Usually to look at photos. That’s about it.
September 15, 2014 at 1:19 pm #183152chrisburton
ParticipantCan I ask why exactly? I have found the command line to be the most powerful tool in all of computer science. It may seem awkward and first but I promise you… you will grow to prefer it. I literally don’t even use my traditional file manager anymore. VERY RARELY will I ever open it. Usually to look at photos. That’s about it.
I come from a design background so I’m used to a GUI of some sort. It’s just a bit too much to dive into OOP, git and the command line. Perhaps down the road but not right now. And in the case that I do screw something up, that’s just more time wasted that I don’t really have.
I think I’ll feel more comfortable using dploy.io at this stage.
September 15, 2014 at 1:24 pm #183154nixnerd
ParticipantI think I’ll feel more comfortable using dploy.io at this stage.
Fair enough. I can respect it. I wasn’t able to “visualize” what I was doing in the command line for a long time… so I definitely get it.
Besides, it’s actually good to have a wide variety of workflows on these forums so we can better assist newcomers… the ones that actually stay.
September 15, 2014 at 1:47 pm #183158chrisburton
ParticipantI’m just glad Chris added a chat to the sidebar so we can now avoid off-topic comments that may confuse people (e.g. php web app discussion).
September 15, 2014 at 1:50 pm #183159nixnerd
ParticipantI’m just glad Chris added a chat to the sidebar
WHAT?!?! I saw the ad and had no clue it was something for us. Sweet!
php web app discussion
Yeah, that thread is epic.
September 15, 2014 at 2:02 pm #183162chrisburton
ParticipantOk. It’s all working now with dploy.io automatically. This is not to say that I don’t appreciate all the help and suggestions, I’m just not at the point to want to learn an additional subject. I hope you guys can understand this (I know you do, Joe).
-
AuthorPosts
- The forum ‘Other’ is closed to new topics and replies.