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
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 forLocal Repository: Win10 C:/git/projectFolder
> git clone email@example.com:/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?Answer1:
The <em>thing</em> you are missing is that a <strong>bare</strong> repository has no files for you to look at.
From the docs at <a href="https://git-scm.com/docs" rel="nofollow">git-scm.com/docs</a> see <a href="https://git-scm.com/docs/git-config#git-config-corebare" rel="nofollow">this explanation</a> about what the
core.bare setting does
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 or git-merge.
This setting is automatically guessed by git-clone or git-init 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).</blockquote>
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
The file changes you expect to see only live in the <strong>bare</strong> repository as commit objects in binary form (I won't go into details)
But everything is there under the
Hope that explains enough.