0

First of all, yes there are a lot of topic out there and it is overwhelming to the point that I get more confused rather than pin-pointing out the right stuff.

For starters, I am learning git and trying to apply it to my first project.

My set up is like this:

Remote Repository: Linux /opt/projectFolder

Note that the projectFolder contains initial files in it.

The following command I run:

git init --bare <-- doesnt work, it seems I am having errors because I have a config folder which my project uses, so it conflicts with the git, i don't know how to fix it.

So what I did is:

> git init
> git add .
> git commit -m"Initial Files"
> git --bool core.bare true

That worked without any errors, now for

Local Repository: Win10 C:/git/projectFolder

I run:

> git clone user@192.168.xx.xx:/opt/projectFolder

it cloned the repository successfully, now I tried to edit some text file from the initial files with it and then i run:

> git add .
> git commit -m"Test commit"
> git push

when I checked the linux remote repo the changes on the files didn't reflected BUT if I clone it on other computers the changes are reflected

What am I doing wrong or missing?

Community
  • 1
  • 1
Roi
  • 503
  • 1
  • 12
  • 25
  • Did the answer help you? If so maybe consider accepting the answer, or if not provide more information so that we can help you further. – AnimiVulpis Jan 17 '18 at 18:49

1 Answers1

0

The thing you are missing is that a bare repository has no files for you to look at.

From the docs at git-scm.com/docs see this explanation about what the core.bare setting does

core.bare

If true this repository is assumed to be bare and has no working directory associated with it. If this is the case a number of commands that require a working directory will be disabled, such as git-add[1] or git-merge[1].

This setting is automatically guessed by git-clone[1] or git-init[1] when the repository was created. By default a repository that ends in "/.git" is assumed to be not bare (bare = false), while all other repositories are assumed to be bare (bare = true).

I did not know that you can turn a repository post-initialization into a bare repository, but it seems to have worked for you.

In my opinion you should have gotten a

 ! [remote rejected] master -> master (branch is currently checked out)

error, but that might depend on the git version.


The file changes you expect to see only live in the bare repository as commit objects in binary form (I won't go into details)

But everything is there under the refs/ and objects/ folders.

Hope that explains enough.

Community
  • 1
  • 1
AnimiVulpis
  • 2,670
  • 1
  • 19
  • 27