致命:无法在"node_modules/Base64"上创建目录:权限被拒绝,在git checkout master期间 [英] fatal: cannot create directory at 'node_modules/Base64': Permission denied, During git checkout master
问题描述
我有一个功能分支,它比master分支提前了约50次提交.我想签出master分支进行小的编辑并将其推出.尽管在我键入git checkout master
时提示我提交更改,但是突然git取消了我所做的所有提交的阶段,并要求我在检出master之前提交它们.
I have a feature branch that is about 50 commits ahead of the master branch. I wanted to checkout master branch to make a small edit and push that out. Although as soon as I type git checkout master
I was prompted to commit my changes, all of a sudden git had un-staged all the commits I had made and was asking me to commit them before checking out master.
本质上是将我的功能分支重置回原来的主人状态.我提交并硬重置为该分支上的最新提交,以免丢失我的所有工作.自从我添加和删除了许多文件以来,是否发生某种错误?
Essentially reseting my feature branch back to what master looked like in the first place. I committed and hard reset back to my most recent commit on that branch as to not lose all my work. Is there some kind of error going on since I have added and removed many files?
编辑更多信息
我删除了一个node_module browserify,但是该模块在主服务器上.
在我的功能分支上,所有内容都已添加并提交.这是我键入git checkout master
后立即得到的错误.
I deleted a node_module browserify but the module is on master.
On my feature branch everything is added and committed. This is the error I get right after I type git checkout master
.
error: unable to create symlink node_modules/.bin/JSONStream: Permission denied
error: unable to create symlink node_modules/.bin/acorn: Permission denied
error: unable to create symlink node_modules/.bin/browser-pack: Permission denied
error: unable to create symlink node_modules/.bin/browserify: Permission denied
error: unable to create symlink node_modules/.bin/deps-sort: Permission denied
error: unable to create symlink node_modules/.bin/insert-module-globals: Permission denied
error: unable to create symlink node_modules/.bin/miller-rabin: Permission denied
error: unable to create symlink node_modules/.bin/module-deps: Permission denied
error: unable to create symlink node_modules/.bin/sha.js: Permission denied
error: unable to create symlink node_modules/.bin/umd: Permission denied
fatal: cannot create directory at 'node_modules/Base64': Permission denied
error: unable to create symlink node_modules/.bin/JSONStream: Permission denied
error: unable to create symlink node_modules/.bin/acorn: Permission denied
error: unable to create symlink node_modules/.bin/browser-pack: Permission denied
error: unable to create symlink node_modules/.bin/browserify: Permission denied
error: unable to create symlink node_modules/.bin/deps-sort: Permission denied
error: unable to create symlink node_modules/.bin/insert-module-globals: Permission denied
error: unable to create symlink node_modules/.bin/miller-rabin: Permission denied
error: unable to create symlink node_modules/.bin/module-deps: Permission denied
error: unable to create symlink node_modules/.bin/sha.js: Permission denied
error: unable to create symlink node_modules/.bin/umd: Permission denied
fatal: cannot create directory at 'node_modules/Base64': Permission denied
执行完此操作后(我正在使用webstorm,因此它在面板中显示了我的版本控制),我的版本控制显示我所有的提交都不是红色的,需要添加它们",但这不是添加我提交添加反.所以摆脱掉我所有的承诺.
Right after I do this, (btw I am working on webstorm so it shows me my version control in a panel), my version control shows all my commits are not in red and need to "add them" but this is not adding my commits its adding the inverse. So getting rid of all my commits.
我也在Mac上的一个无聊的盒子上工作.
Also I am working on a vagrant box on mac.
推荐答案
sudo
是您的问题,而不是解决方案.不要将sudo
用于与开发有关的任务.曾经.也不要使用sudo git ...
.您不需要管理员权限即可工作和使用Git. Git不能用作根.
sudo
is your problem, not the solution. Don't use sudo
for development-related tasks. Ever. Don't use sudo git ...
ever either. You don't need admin permission to work and use Git. Git is not meant to be used as root.
您的问题是您过去可能使用过sudo
,因此您以root
身份运行了一个命令,并创建了一些属于root
的文件.您可以使用例如ls -l
或find . -user 0
.然后,下次您尝试修改这些属于root的文件时,您无权执行此操作(请参见错误消息:Permission denied
).
Your problem is that you probably used sudo
in the past, hence you ran a command as root
and you created some files that belong to root
. You can check this with e.g. ls -l
or find . -user 0
. Then, the next time you tried to modify these files belonging to root, you don't have permission to do it (see the error message: Permission denied
).
实际的解决方案是使用chown
将文件退还给普通用户,为此,您需要使用sudo
一次 次.
The actual solution is to give back the files to your normal user, using chown
, for which you will need to use sudo
one last time.
这篇关于致命:无法在"node_modules/Base64"上创建目录:权限被拒绝,在git checkout master期间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!