Creating a new GIT repository
This tutorial will show you how to create a new GIT repository on your Site5 account. GIT is an alternative to Subversion (SVN) and is a great way to manage a code repository or project you’re working on. GIT is installed by default on all of our shared, reseller, VPS, and dedicated servers.
1. Login to your Site5 account via SSH (command line).
2. Let’s first create a folder inside of our home directory where we’ll keep all of our GIT repositories separate from our other files:
Note: The “git” directory is where we are going to store all of our repositories. For this tutorial, my test project will simply be called “project.” I’m going to walk you through setting up a fresh git repository on a blank project, but if you already have a project on your machine, now would be the time to upload it to the “git” directory we just created.
3. Let’s create a new GIT project:
cd ~/git; mkdir project.git; cd project.git
4. Next, we will initialize our GIT repository:
After you run the above command, the output will look something like the below:
Initialized empty Git repository in /home/user/git/project.git/.git/
5. We can then add some sample files to our new project:
cd ~/git/project.git; touch test1; touch test2
echo "Site5 Is The Greatest" > test1; echo "testing" > test2
6. After we have added the test files, we need to “add” them to our repository:
git add test1 test2
7. Now we can “commit” the changes to our repository:
git commit -a -v
The above command will open a new window in your default command-line text editor asking for a commit message. You can type whatever you want here.
8. After you commit your changes, you can check the status of the repository:
firstname.lastname@example.org [~]# git status # On branch master nothing to commit (working directory clean)