1

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"

1
  • 1
    Please learn the difference. git /= github Commented Dec 24, 2017 at 21:33

2 Answers 2

2

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.

Sign up to request clarification or add additional context in comments.

2 Comments

Got It, I get those files from remote repository by cloning. Just I have cloned remote resposity I am able see the files..
@meteor23 well, congrats for your first Git server setup then :)
0

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.

3 Comments

are you telling me to use ssh protocol in this case?
The protocols supported depend on the git server. If the git protocol is supported, use it. Next best is ssh. Next best is http.
Ok Let me try the git protocol and other permissions options. Thanks

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.