Friday, June 13, 2014

Getting Git on Server

Getting Git on Server:

In order to initially set up any Git server, you have to export an existing repository into a new bare repository.

git clone path_of_my_project.git
Initialized empty Git repository in /opt/path_of_project.git

The output for this command is a little confusing. Because clone is basically a git init and then a git fetch, you see some output from the git init part, which creates an empty directory. The actual object transfer gives no output, but it does happen. You should now have a copy of the Git directory data in your my_project.git directory.

This is roughly equivalent to something like

cp -Rf my_project/.git my_project.git

Putting Bare Repository on server:

Let’s say you’ve set up a server called git.example.com that you have
SSH access to, and you want to store all your Git repositories under the /opt/git directory.
You can set up your new repository by copying your bare repository over:

scp -r my_project.git user@git.example.com:/opt/git

we can clone repository by this

git clone user@git.example.com:/opt/git/my_project.git

No comments:

Post a Comment