Collaborate Quickly With git

In the following article I am going to illustrate how you can share a git project with your team within your local area network.

Note: I am using Ubuntu OS throughout this article.

First thing first :

you have to decide your workflow first, it can be in 2 ways:

1 dedicate a machine
2 share from your personal computer

Anyway whatever you decide this can be achieve by using ssh authentication or using git demon.

In this section we are focusing on sharing using ssh key authentication…….

Lets understand this by following scenario:

lets assume Bob,Alice and Mike is a part of a small team and working on modules of same project.

now its necessary to make sure they can work on same code without interrupting someone else’s workflow

so, they decided to use git for version control:

What is Git ?

Git is a free and open source distributed version control system designed to handle everything from small to very large projects with speed and efficiency.

Now instead of going with available services like github or bitbucket they have decided to use git locally over LAN

now they have chosen a regular computer with regular office machine i am going to call this a git server in further story…….

Now Bob, Alice and Mike generate ssh keys by hitting the command into terminal  this will generate new key value pair for your computer, backup your keys if already exists or it will be overrides……

science our employees doing it first time they will get the following results:

i have changed the save path ,one can keep this default. to keep default press the enter key

 

Next step :

copy id_rsa.pub file for each employee to git server

Tip:
copy directly from your computer to any other computer using scp
by hitting following command :

for example the command for copy id_rsa.pub from employees computer to git server as follows:

now from  perform  and for rest of people.

reason of adding public keys of all users to  to avoid entering password each time while doing ssh to remote server and further git processes like cloning the repository.

That’s it!!

now our employees can able to clone project repository from our local git server machine………..

Now from gitserver computer :

now within our  directory run a command  it will : Create an empty Git repository or reinitialise an existing one

now either you can perform this command within existing project or within our newly created directory.

after initialising mywebsite as git create any file likethen stage the changes by performing  it will add your changes to staging area, after that perform when -m stands for commit message.

now if you hit it will show all branches available. results wil be simmilar to  which is our default branch:

you can modify your terminal to display current working branch just past the following code end of ~/.bashrc file [ubuntu : may need to edit with sudo for take changes to effect, then perform source ~/.bashrc to save modifications]

 

now we are done at server side for now…….

now our employees can clone this repository by hitting git clone

command will look like following in our case git clone  for example Alice can clone our project mywebsite by running following command within her terminal 

now Alice can found a directory named mywebsite within the location she has performed git clone, now she can perform all her tasks by creating a separate branch for her module of work.

Now remember the option you have decided!

If we have dedicated server for git then you should initialise git with git 

but if work need to be done on gitserver as well then one may also face fetal error while checking out master branch because its already checked on git server.

Tip:

if you are also need to work on server you should make temporary branch and keep it checked out on server to avoid master already checked out error.

Read More
Smit Modh September 9, 2019 0 Comments