Git push origin master Clone the New Repository Push all of the new content to the server with the command: Git commit -a -m "Test directories and files added." We can now add those files to git with the command: Touch test1/testing1 test2/testing2 test3/testing3 Next, create test files with the command: First create the directories with the command: Git remote add origin SERVER_IP is the IP address of the HTTP Git Server hosting server.Ĭreate some test directories and files. Initialize the repository with the command:Īdd the origin (taken from our HTTP Git Server) with the command: If you’re using a different platform, some of the steps will vary.Ĭreate a local repository with the command:Ĭhange into that new repository with the command: I’m going to demonstrate the next steps on a Ubuntu Linux desktop machine.
If the machine is a Linux workstation, you can install git with one of the following commands (first for Debian-based distributions and second for Red Hat-based distributions): If that machine doesn’t have git installed, do so now. It’s finally time to connect a desktop to the repository. Issue the command:Ĭhange the ownership of the new repository with the command:Ĭhange the permissions of the repository with the command:
Next, we want to update the Git server, so it’s aware of the changes. Now we’ll initialize the repository with the command: Now create the repository with the command:Ĭhange into this new directory with the command: To create the new repository, change into the git directory with the command: Remember, however, to create a repository using the same name as you did when you created the new user account. Since we just created the user, jack, we’ll stick with that.
It’s time to create your first repository. Sudo systemctl restart nginx Create Your First Repository Once that’s complete, restart NGINX with the command: You’ll be prompted to type and verify a new password for the user. Sudo htpasswd -c /var/www/html/git/htpasswd jack To create the new user, issue the command: I’ll demonstrate by creating the user “jack.” You’ll want to make sure to create a user specific to your needs. We’ll do this by way of the htpasswd command. We now need to create a user that will have access to the HTTP Git Server.
If you do see errors, go back into the configuration file and make sure the above code was pasted in the proper section. Nginx: the configuration file /etc/nginx/nf syntax is oknginx: configuration file /etc/nginx/nf test is successful You should see the following reported back: Run the NGINX configuration test with the command: Sudo nano /etc/nginx/sites-available/default To do this, open the default NGINX site configuration file with the command: NGINX must now be configured, such that it knows to serve up the repositories on the server. Sudo chown -R www-data:www-data /var/www/html/git Configure NGINX Give that directory the proper ownership with the command: With everything installed, create a directory to house our Git repositories with the command: Create a Git Directory to House Repositories
That’s all there is to the installation of software on your server. Sudo apt-get install nginx git nano fcgiwrap apache2-utils -y You can install everything necessary for HTTP Git Server with a single command. When this completes, reboot the server (if necessary).
Once apt is updated, upgrade the server with the command: Log into your Ubuntu server and update apt with the command: Because of this, make sure to run the update/upgrade at a time when a reboot is possible. Remember, however, if the kernel is upgraded in the process, you’ll need to reboot the server. The first thing you’ll want to do is update and upgrade your instance of Ubuntu server.