Question

Have been using git via xcode on iMac, but now I have a macbook air, and am trying to get the git repos to act as siblings so I can work on either one. Usually I work at home, but may take the macbook away sometimes.

I tried setting up the macbook project via clone. After miscellaneous lacks of success I installed SourceTree on both computers. Currently, when I try to push from the Air to the iMac I get the following message (in the Air SourceTree push):

Pushing to /Volumes/jr/develop/Ideation remote: error: refusing to update checked out branch: refs/heads/master
remote: error: By default, updating the current branch in a non-bare repository
remote: error: is denied, because it will make the index and work tree inconsistent
remote: error: with what you pushed, and will require 'git reset --hard' to match
remote: error: the work tree to HEAD.
remote: error: ...

(From this you can see I'm using file sharing).

When I tried this push in SourceTree on the macbook Xcode was open on neither machin

I don't understand the checked out branch message, and I thought I could update a non-bare repository with a push. Obviously I'm missing something!

I'm new to understanding git (as opposed to just doing commits in XCode). I've been reading a variety of git docs, including progit, gitref.org, and various responses on stack overflow.

Était-ce utile?

La solution

For anyone else who stumbles onto this:

My question is really answered at Pushing git repository to Xcode.

In summary, since iMac is on essentially all the time, and since git (appropriately) abhores pushing to a non-bare repository, the (one) solution to syncing is to set up a bare repository on the imac, and push and pull from this for both working copies.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top