{"thread":{"id":"30974","subject":"Problems pushing???","startedAt":"2012-07-08T09:12:46Z","lastAt":"2012-07-10T06:59:18Z","messageCount":8,"participants":["pbGit","Konstantin Khomoutov","Holger Hellmuth"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"194778","messageId":"1341738766823-7562695.post@n2.nabble.com","threadId":"30974","inReplyTo":null,"subject":"Problems pushing???","fromName":"pbGit","fromEmail":"pblakeley@gmail.com","sentAt":"2012-07-08T09:12:46Z","receivedAt":"2012-07-08T09:12:46Z","isPatch":false,"sender":{"key":"pblakeley@gmail.com","avatar":null},"body":"Hi,\n  I have installed git locally to my machine.  It is running mac os lion. \nThis is intended to be the remote machine too. I have followed, what I think\nis the correct way to do this, using \nhttp://www.petermac.com/setup-git-local-and-remote-repositories/ this .  All\nseemed to be ok until I tried to push.  When I try the following command.\n\ngit push --all --repo=<project>\n\nI get the following output\n\nCounting objects: 12, done.\nDelta compression using up to 4 threads.\nCompressing objects: 100% (11/11), done.\nWriting objects: 100% (12/12), 5.23 KiB, done.\nTotal 12 (delta 1), reused 0 (delta 0)\nremote: error: refusing to update checked out branch: refs/heads/master\nremote: error: By default, updating the current branch in a non-bare\nrepository\nremote: error: is denied, because it will make the index and work tree\ninconsistent\nremote: error: with what you pushed, and will require 'git reset --hard' to\nmatch\nremote: error: the work tree to HEAD.\nremote: error: \nremote: error: You can set 'receive.denyCurrentBranch' configuration\nvariable to\nremote: error: 'ignore' or 'warn' in the remote repository to allow pushing\ninto\nremote: error: its current branch; however, this is not recommended unless\nyou\nremote: error: arranged to update its work tree to match what you pushed in\nsome\nremote: error: other way.\n  \nHope someone can help with this because I have spent a bit of time trying to\nsolve this and still stuck!!!\n\nThanks for your time,\n Paul\n\n--\nView this message in context: http://git.661346.n2.nabble.com/Problems-pushing-tp7562695.html\nSent from the git mailing list archive at Nabble.com.\n"},{"id":"194781","messageId":"20120708110244.GA14518@localhost.localdomain","threadId":"30974","inReplyTo":"1341738766823-7562695.post@n2.nabble.com","subject":"Re: Problems pushing???","fromName":"Konstantin Khomoutov","fromEmail":"kostix+git@007spb.ru","sentAt":"2012-07-08T11:02:45Z","receivedAt":"2012-07-08T11:02:45Z","isPatch":false,"sender":{"key":"kostix+git@007spb.ru","avatar":null},"body":"On Sun, Jul 08, 2012 at 02:12:46AM -0700, pbGit wrote:\n\n>   I have installed git locally to my machine.  It is running mac os lion. \n> This is intended to be the remote machine too. I have followed, what I think\n> is the correct way to do this, using \n> http://www.petermac.com/setup-git-local-and-remote-repositories/ this .  All\n> seemed to be ok until I tried to push.  When I try the following command.\n> \n> git push --all --repo=<project>\n> \n> I get the following output\n> \n> Counting objects: 12, done.\n> Delta compression using up to 4 threads.\n> Compressing objects: 100% (11/11), done.\n> Writing objects: 100% (12/12), 5.23 KiB, done.\n> Total 12 (delta 1), reused 0 (delta 0)\n> remote: error: refusing to update checked out branch: refs/heads/master\n[...]\n> Hope someone can help with this because I have spent a bit of time trying to\n> solve this and still stuck!!!\nBecasue pushing to a so-called \"non-bare\" repository (this is a \"normal\"\nrepository, in which there is a work tree) either has no sense or\nrequires extra steps to reconcile the results of pushing with the\nrepository's work tree.  Most probably you should reconsider your\nworkflow.\n\nRead [1] for an in-depth explanation.\nGoogling for \"receive.denyCurrentBranch\" will also provide you with\na number of useful links (such as stackoverflow discussions).\n\n1. http://sitaramc.github.com/concepts/bare.html\n"},{"id":"194782","messageId":"4FF97463.90002@ira.uka.de","threadId":"30974","inReplyTo":"1341738766823-7562695.post@n2.nabble.com","subject":"Re: Problems pushing???","fromName":"Holger Hellmuth","fromEmail":"hellmuth@ira.uka.de","sentAt":"2012-07-08T11:52:03Z","receivedAt":"2012-07-08T11:52:03Z","isPatch":false,"sender":{"key":"hellmuth@ira.uka.de","avatar":null},"body":"Am 08.07.2012 11:12, schrieb pbGit:\n> http://www.petermac.com/setup-git-local-and-remote-repositories/ this .  All\n\nThe recipe at this address seems to have a \"--bare\" parameter missing at \nthe git init in step 7\n"},{"id":"194783","messageId":"20120708122122.GB14518@localhost.localdomain","threadId":"30974","inReplyTo":"4FF97463.90002@ira.uka.de","subject":"Re: Problems pushing???","fromName":"Konstantin Khomoutov","fromEmail":"kostix+git@007spb.ru","sentAt":"2012-07-08T12:21:23Z","receivedAt":"2012-07-08T12:21:23Z","isPatch":false,"sender":{"key":"kostix+git@007spb.ru","avatar":null},"body":"On Sun, Jul 08, 2012 at 01:52:03PM +0200, Holger Hellmuth wrote:\n\n>>http://www.petermac.com/setup-git-local-and-remote-repositories/ this .  All\n> \n> The recipe at this address seems to have a \"--bare\" parameter\n> missing at the git init in step 7\nThe OP stated that «This is intended to be the remote machine too.»\nwich hints he wants to also receive changes to this repo from the\noutside.\nSupposedly he should stick to pulls only.\nOr set up a bare repo on the local machine and then clone it to its\n\"working\" repo using a plain path like /path/to/that/shared/repo.\n"},{"id":"194787","messageId":"1341759063006-7562705.post@n2.nabble.com","threadId":"30974","inReplyTo":"4FF97463.90002@ira.uka.de","subject":"Re: Problems pushing???","fromName":"pbGit","fromEmail":"pblakeley@gmail.com","sentAt":"2012-07-08T14:51:03Z","receivedAt":"2012-07-08T14:51:03Z","isPatch":false,"sender":{"key":"pblakeley@gmail.com","avatar":null},"body":"Hi Holger,\n  I think you were correct.  I deleted my git init on the remote(Well,\nlocally on my machine...), did what you said I was able to push\nsuccessfully.  Can I check the files have been successfully transferred to\ncorrect location??? Just wanted a bit of confidence it has done what it\nshould of.  I guess I can simply clone this from another machine and test? \n\n--\nView this message in context: http://git.661346.n2.nabble.com/Problems-pushing-tp7562695p7562705.html\nSent from the git mailing list archive at Nabble.com.\n"},{"id":"194789","messageId":"1341762216101-7562707.post@n2.nabble.com","threadId":"30974","inReplyTo":"1341759063006-7562705.post@n2.nabble.com","subject":"Re: Problems pushing???","fromName":"pbGit","fromEmail":"pblakeley@gmail.com","sentAt":"2012-07-08T15:43:36Z","receivedAt":"2012-07-08T15:43:36Z","isPatch":false,"sender":{"key":"pblakeley@gmail.com","avatar":null},"body":"Just tried starting again on my local machine because when I tried pushing,\ngit said that it local was also set to bare init.  When I looked this was\nthe case.  Silly me.  \n\nSo I deleted on my local and added a single file and when I try pushing this\nI get the following:\n ! [rejected]        master -> master (non-fast-forward)\nerror: failed to push some refs to 'paul@localhost:/Users/paul/<prject>'\nhint: Updates were rejected because the tip of your current branch is behind\nhint: its remote counterpart. Merge the remote changes (e.g. 'git pull')\nhint: before pushing again.\nhint: See the 'Note about fast-forwards' in 'git push --help' for details.\n\nWhen I try and pull I then get the following:\nfatal: No remote repository specified.  Please, specify either a URL or a\nremote name from which new revisions should be fetched.\n\nI then addded my repo with the following command, but  this is the wrong\nsyntax!!!\ngit pull --repo=<project>\n\nWhat the hell am I doing wrong???\n\n--\nView this message in context: http://git.661346.n2.nabble.com/Problems-pushing-tp7562695p7562707.html\nSent from the git mailing list archive at Nabble.com.\n"},{"id":"194791","messageId":"4FF9F999.9030808@ira.uka.de","threadId":"30974","inReplyTo":"1341762216101-7562707.post@n2.nabble.com","subject":"Re: Problems pushing???","fromName":"Holger Hellmuth","fromEmail":"hellmuth@ira.uka.de","sentAt":"2012-07-08T21:20:25Z","receivedAt":"2012-07-08T21:20:25Z","isPatch":false,"sender":{"key":"hellmuth@ira.uka.de","avatar":null},"body":"Am 08.07.2012 17:43, schrieb pbGit:\n> Just tried starting again on my local machine because when I tried pushing,\n> git said that it local was also set to bare init.  When I looked this was\n> the case.  Silly me.\n>\n> So I deleted on my local and added a single file and when I try pushing this\n> I get the following:\n>   ! [rejected]        master ->  master (non-fast-forward)\n> error: failed to push some refs to 'paul@localhost:/Users/paul/<prject>'\n> hint: Updates were rejected because the tip of your current branch is behind\n> hint: its remote counterpart. Merge the remote changes (e.g. 'git pull')\n> hint: before pushing again.\n> hint: See the 'Note about fast-forwards' in 'git push --help' for details.\n>\n> When I try and pull I then get the following:\n> fatal: No remote repository specified.  Please, specify either a URL or a\n> remote name from which new revisions should be fetched.\n>\n> I then addded my repo with the following command, but  this is the wrong\n> syntax!!!\n> git pull --repo=<project>\n>\n> What the hell am I doing wrong???\n\nThis is the moment where you have to begin reading man pages, i.e. \"git \nfetch\", \"git help pull\", \"git help remote\" \"git help push\" (read the \nexamples as they show typical use cases) or preferably read about it in \nbooks like Pro Git (git-scm.com/book/) or tutorials.\n\nFor example the --repo parameter in \"git push --repo=<project>\" doesn't \nexactly do what you think it does. It only sets the default remote repo \nfrom \"origin\" to <project>. Normally you would just use \"git push \n<project>\". And the equivalent pull command would be \"git pull <project>\".\n\nNaturally you can configure that git pull or git push will just do what \nyou want, but for that you need to know what a refspec is and how to use \n\"git remote\".\n\nGenerally git pull and git push are not complementary. Neither in effect \nnor in parameters they take.\n\nFor example assume you have just cloned a remote repository. This will \nadd configuration that connects both repositories and adds a default \nremote repo named origin and adds default refspecs\n\n\"git pull\" without parameters will then fetch all remote branches into \ncorrepondingly named local remote tracking branches (under \n.git/refs/remotes/, do a git branch -a to list them too), but then only \nmerge one of them with the branch you are in at the moment.\n\nBut \"git push\" will push *all* your local branches into branches of the \nsame name on the remote repository.\n\nAnother difference: If you pull, the merge might fail because of merge \nconflicts and you have to manually merge conflicting files. If you push, \nthis manual merge is not possible so usually only trivial merges called \nfast-forward-merges are allowed. That is what happened on your push\n\nSomething like \"git remote add -m master origin <urlofyourrepo>\" does \nthe same configuration as a \"git clone\" would do and would allow you to \njust use \"git pull\" without parameters.\n"},{"id":"194842","messageId":"1341903558821-7562762.post@n2.nabble.com","threadId":"30974","inReplyTo":"4FF9F999.9030808@ira.uka.de","subject":"Re: Problems pushing???","fromName":"pbGit","fromEmail":"pblakeley@gmail.com","sentAt":"2012-07-10T06:59:18Z","receivedAt":"2012-07-10T06:59:18Z","isPatch":false,"sender":{"key":"pblakeley@gmail.com","avatar":null},"body":"Thanks for all your help.  Running through this a few more times and reading\nthe net I managed it ; )  I tested it cloning from the command line and all\nseems good.\n\nFor developement I use eclipse with the eGit plugin.  When I try cloning it\nputting all the relevant info in it fails.   I am sure this is due to the\nssh keys. I have set-up my keys accordingly.  Tried using the ssh agent but\nwith no success.  I can see the agent is running and tested that  and all\nseems good with that. The error get is \n\nssh://paul@localhost:22:\norg.eclipse.jgit.transport.CredentialItem$StringType:Password:\nssh://paul@localhost:22:\norg.eclipse.jgit.transport.CredentialItem$StringType:Password:\n\nHope you can help\n\n--\nView this message in context: http://git.661346.n2.nabble.com/Problems-pushing-tp7562695p7562762.html\nSent from the git mailing list archive at Nabble.com.\n"}]}