86646

Git bare repository doesnt reflect changes made from push

Question:

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?

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

<blockquote>

<strong>core.bare</strong>

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).

</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 git version.

<hr />

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 refs/ and objects/ folders.

Hope that explains enough.

Recommend

  • Two column unique constraint ActiveAndroid
  • Gforce min not supported for character in data.table
  • The symbol you provided is not a function
  • Deleting a widget from QTableView
  • calling a fragment from fragment
  • Entity Framework ObjectContext: Concurrency
  • cd command not working with execvp
  • multidatatrigger with multibinding in ControlTemplate.Triggers
  • SqlCommand back up Database
  • Is there a parser equivalent of 'fragment' marking in ANTLR4?
  • Problems with toDataURL HTML5 other ways to get canvas data?
  • Find JSON nested nodes using multiple string values
  • How to get links to open in the native browser in iOS Meteor apps?
  • blade.php method outputting it's result to the form
  • xcode don't localize specific strings
  • Build Successful but not running on simulator
  • How to revert to previous XCode version?
  • Make VS2015 use angular-cli ng at build time in a .NET project
  • Bug in WPF DataGrid
  • TFS: Get latest causes slow project reloading
  • Javascript Callbacks with Object constructor
  • Where to put my custom functions in Wordpress?
  • How to make Safari send if-modified-since header?
  • Do create extension work in single-user mode in postgres?
  • R: gsub and capture
  • Numpy divide by zero. Why?
  • jqPlot EnhancedLegendRenderer plugin does not toggle series for Pie charts
  • How do I rollback to a specific git commit
  • Is there a mandatory requirement to switch app.yaml?
  • Comma separated Values
  • Angular 2 constructor injection vs direct access
  • Java static initializers and reflection
  • Android Google Maps API OnLocationChanged only called once
  • Busy indicator not showing up in wpf window [duplicate]
  • costura.fody for a dll that references another dll
  • Observable and ngFor in Angular 2
  • How to Embed XSL into XML
  • UserPrincipal.Current returns apppool on IIS
  • Conditional In-Line CSS for IE and Others?
  • How to load view controller without button in storyboard?