So I'm new to version control, and of courre, all things Git. I'm just wondering, what is the best way to handle sending my commits to my live web server?
Currently I'm making changes on my local machine, committing, then manually uploading revised files via ftp. But I assume there's a slick way (probably using the "Push" feature???) to automagically push files in a commit to the web server. Just thought I'd ask before possibly mucking something up!
Yes, transmitting changes to another repository, whether that's over a file system, or a http protocol, or a ssh protocol, is done using 'Push'. You configure a remote to push to - you give it a name, and a URL, which might be something like https://email@example.com/yourusername/yourrepo for example. Pushing is more sophisticated than just replicating the files, because it only pushes what's new, and in git you can also choose which branches you want to push. It also plays nicely when you start adding more users to the repository.
The easiest way to create a remote is to click the 'Settings' button on a repository window (toolbar top right), and add a new remote. You need somewhere to push, the easiest way to do this is to create a Bitbucket account and then create a Git repository there, which will be empty until you push to it. Bitbucket allows you to have free private repositories for up to 5 people so it's a great way to try it out with no setup overhead. In fact, if you want you can configure your Bitbucket account in SourceTree (View > Show Hosted Repositories > Edit Accounts), and once you've done that, you can see your Bitbucket repositories in a list to get to their URLs quickly for cloning or configuring in the Settings window, and you can even create new repositories on Bitbucket from inside SourceTree.
Nice! Thanks Steve! Working with BitBucket seems easy enough.
Though, it's not clear how I can set up my own repo on a web server, in this case, on MediaTemple.
I left the console behind in the 90's and everything I can find on the web involving seting up a repo on a web server is exclusivelly console work *shudder*.
A lot depends on how comfortable you are with writing bash/python scripts or other simple automation tools.
My own approach would always be to create a separate publication script. That's because I always want the ability to fine-tune what gets uploaded, filter out files that shouldn't go, do emergency uploads, and so on. Then I would add this as a post-commit hook in my master repository, which would be local in a simple project.
By strong preference I would use rsync to do the upload. It's efficient and bullet proof. Not every web service supports this though. And I would always publish from a clean checkout of the code.
I know this isn't as simple an answer as you might like but it's a good, solid workmanlike process that is suitable for small to medium sized projects.
Supported Platforms macOS Windows We recently introduced support for additional hosting services such as GitHub Enterprise, GitLab (Cloud, Community Edition, Enterprise Edition), and...
Connect with like-minded Atlassian users at free events near you!Find a group
Connect with like-minded Atlassian users at free events near you!
Unfortunately there are no AUG chapters near you at the moment.Start an AUG
You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs