0%

今天打开WSL发现直接报错:

1
2
3
>wsl
Error: 0x80040326
Error code: Wsl/Service/0x80040326

随后迅速Google此错误代码,发现这和Windows10更新有关,在Windows10更新后需要手动更新WSL才能正常运行。因此执行wsl --update,不久会弹出:

image-20230330165334041

随后即可正常启动WSL。

Reference

https://stackoverflow.com/questions/12265729/what-are-the-consequences-of-using-receive-denycurrentbranch-in-git

https://www.gloomycorner.com/pushing-to-a-non-bare-git-repository/

git push时遇到:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
...
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:
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.
remote: error:
remote: error: To squelch this message and still keep the default behaviour, set

remote: error: 'receive.denyCurrentBranch' configuration variable to 'refuse'.

则这是由于本地和远程都使用git init默认方式创建仓库,于是都会默认地设置成non-bare(具体含义参见第一则reference,即正常有提交记录的仓库),git默认禁止non-bare之间push(原因第一则reference也讲得很清楚了)。

简单解决方法:远程git config receive.denyCurrentBranch updateInstead(也可以设置成别的,参见第二则reference);

根本解决方法:git clone --bare