pushing to a git repository does not work

前端 未结 4 746
予麋鹿
予麋鹿 2020-12-09 06:06

I am just starting out with GIT (i\'m coming from cvs) and would like to set up something akin to cvs/svn with Git. I performed the following steps:

cd o:/r         


        
4条回答
  •  無奈伤痛
    2020-12-09 07:01

    If you still want to push to a checked out branch of a remote non-bare repo, it is now possible (Git 2.3.0, February 2015), provided there is no modified files in the target working tree.

    In that remote repo, do:

    git config receive.denyCurrentBranch=updateInstead
    

    It is more secure than config receive.denyCurrentBranch=ignore: it will allow the push only if you are not overriding modification in progress.

    See commit 1404bcb by Johannes Schindelin (dscho):

    receive-pack: add another option for receive.denyCurrentBranch

    When synchronizing between working directories, it can be handy to update the current branch via 'push' rather than 'pull', e.g. when pushing a fix from inside a VM, or when pushing a fix made on a user's machine (where the developer is not at liberty to install an ssh daemon let alone know the user's password).

    The common workaround – pushing into a temporary branch and then merging on the other machine – is no longer necessary with this patch.

    The new option is:

    updateInstead
    

    Update the working tree accordingly, but refuse to do so if there are any uncommitted changes.

提交回复
热议问题