Cannot git clone a folder on a server and then edit and git push?

后端 未结 5 790
温柔的废话
温柔的废话 2021-01-14 23:41

I used Mercurial (Hg) before, and it was ok to do something like at the local PC:

hg clone ssh://peter@hostingcompany.com/~/mysite.com

and

5条回答
  •  有刺的猬
    2021-01-14 23:53

    I don't know why people are saying it's not supported. While pushing to a bare repo is the recommended practice, you can push to a non-bare by setting the receive.denyCurrentBranch config variable to 'ignore' or 'warn' as shown by the error message you get (at least on 1.7.1) when you try to do it:

    remote: error: You can set 'receive.denyCurrentBranch' configuration variable to
    remote: error: 'ignore' or 'warn' in the remote repository to allow pushing into
    remote: error: its current branch; however, this is not recommended unless you
    remote: error: arranged to update its work tree to match what you pushed in some
    remote: error: other way.
    

    I would say your workflow where you deploy with a git push followed by a hard reset on the remote side is precisely the exception to the rule for which this config variable was created.

    Also, I haven't tried it personally, but the "current branch" language implies you can push to a remote branch that isn't checked out with no errors at all, after which you could do a fast-forward merge on the remote end into your checked out branch.

提交回复
热议问题