简体   繁体   中英

Is it possible to set a Git/SVN version control on a webhost? And what are the advantages compared to having a personal local server?

I'm quite confused by these concepts. I want to have a version control for my web site project. Should I install Git on my localhost or is it possible to host it on a rented web server? Is it safe? What are the advantages and disadvantages of either option? Is it worth installing it on a localhost first in order to learn how to work with it? Will the learning curve to set it up be smaller on a rented server? How long will it take to learn and setup either option (approximately)? Can I avoid command line configuration on either of the options?

This questions refer to either git or svn, so if there's a difference I'd be interested in knowing what it is.

Go with Git because it's great and it's widely used-- and it is the standard now.

Install git on your web server by issuing

sudo apt-get install git
sudo yum install git

after installing it you need to add your source code into the local repository.

git init .
git commit --allow-empty -m "initial commit"
# add CurrentProduction content
git add .
git commit -m "initial master commit"

# checkout at the empty commit
git checkout -b develop HEAD^

# no need to delete any files!
# working tree is empty
# add CurrentDevelopment  content
git add .
git commit -m "initial develop commit"

You may also try working with remote git repository. They have services like GitHub or BitBucket , and others that I may not be aware of.

This will keep a change of all the files you've modified in your project.

So you edit a file called index.html , then you git commit after that you'll get an editor where you leave notes, then save the file, etc..

On a team effort, this becomes more interesting where you can work on the same files and if there are conflicts, then you merge the diffs (keep the working copies and discard unwanted code and such).

If you know how you use your personal git server, then do it; otherwise, you can configure remote repositories with GitHub or Bitbucket .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM