Git - basics of working with git on a server
In the previous article , we showed the absolute basics for working with git locally. Now let's look at placing the current git repository on the linux server, cloning the project on the local station and how to upload the changes back to the server.
This article assumes that you have a Linux server on your network that you have root access to via SSH and that has git installed. For work, it is advisable to create, for example, a git user (
# We will go to our local project (git repository) and create a clone
1.)
We will upload the # project.git to our server
2.)
#for further development of the project we have to download the clone back to the local from the server
3.)
#we make the necessary changes to the project and commit as before
# changes must then be uploaded to the server in the central git repository
4.)
#if we work on multiple workstations or with multiple developers,
#then you need to download the current version of the project
5.)
If more than one developer is working on a project, you need to know the basics of branching and merging in git, but read about it in the documentation.
This article assumes that you have a Linux server on your network that you have root access to via SSH and that has git installed. For work, it is advisable to create, for example, a git user (
adduser git
) on the server.# We will go to our local project (git repository) and create a clone
1.)
git clone --bare .git project.git
We will upload the # project.git to our server
2.)
rsync -av /tmp/project.git/ git@192.168.17.111: /var/git/project.git
#for further development of the project we have to download the clone back to the local from the server
3.)
git clone git@192.168.17.111: /var/git/project.git
#we make the necessary changes to the project and commit as before
# changes must then be uploaded to the server in the central git repository
4.)
git push origin master
#if we work on multiple workstations or with multiple developers,
#then you need to download the current version of the project
5.)
git pull
If more than one developer is working on a project, you need to know the basics of branching and merging in git, but read about it in the documentation.