meteor23
meteor23

Reputation: 287

Create own Git repo with bare option

I am new to git, Just i want move my project work to Git for version control. Before moving/using Git I am doing testing.

 Note: we are not using Public/Private github. We are using own git reposity server.  

I have shared directory "/share"

I have created bare repostory like below:

 git init --bare /share/centralproject.git

I have created local repo:

 cd /share/local
 #create two files hello.py and README.md
 git init

Locally I have staged and commited like below:

 git add .
 git commit -m "Commit 1"

Added remote repo like below:

 git remote add myremoterepo file:///share/centralproject.git 
 git push myremoterepo master

I did not see any of my files (local repo files hello.py and README.md) in remote repository that is under "/share/centralproject.git"

what i am trying to achieve here is all my codes must reside in central directory in my case "/share/centralproject.git".

We have 10 developer, These developers are going to check in there codes from local repo to remote repository in my case again "/share/centralproject.git"

Upvotes: 1

Views: 208

Answers (2)

Mike Slinn
Mike Slinn

Reputation: 8403

It seems you have conflated the client and server functionality. Both can be performed by one computer. The discussion of the file protocol below addresses this issue.

Do the procedure again, but this time do not create a bare repo. Simply type:

git init

The instructions for creating a new repo on the git server varies according to the server. Please refer to the documentation for your server.

I recommend you use localhost, or any other IP address, instead of the file protocol. From the manual:

Git operates slightly differently if you explicitly specify file:// at the beginning of the URL. If you just specify the path, Git tries to use hardlinks or directly copy the files it needs. If you specify file://, Git fires up the processes that it normally uses to transfer data over a network, which is generally much less efficient. The main reason to specify the file:// prefix is if you want a clean copy of the repository with extraneous references or objects left out — generally after an import from another VCS or something similar (see Git Internals for maintenance tasks). We’ll use the normal path here because doing so is almost always faster.

Upvotes: 0

Quentin
Quentin

Reputation: 63124

That's perfectly normal: a bare repository is a repository without a working directory. You can see that your commit is there by using git log inside your bare repository, but it won't checkout files anywhere.

Upvotes: 2

Related Questions