I am trying to take a git clone from a particular branch of my bitbucket repository using the below command: git clone <url> --branch <branchname>
.
However, I am getting the below error while taking the clone:
error:unable to create file foldername/nodemodules/......: Filename too long.
I tried resolving this by running the below command in my git cmd git config --system core.longpaths true
.
But I am getting:
error: could not lock config file c://.gitconfig: Permission denied error: could not lock config file c://.gitconfig: Invalid argument.
How do I solve these two errors?
git config --system core.longpaths true
Another way (only for this clone):
git clone -c core.longpaths=true <repo-url>
您可以尝试使用命令设置长路径: git config --system core.longpaths true
On Windows there is a maximum file name length limit of 260 characters.
See https://superuser.com/questions/811146/windows-7-file-name-length-limited-to-129-characters for how to remove it.
I was not having admin rights. So I had to go to config file in .git folder (hidden) in the same folder that you started the clone in local machine . Then add ' longpaths = true ' under [core] .Run git reset --hard origin/xxx from Git Bash. This worked for me.
Basically we need to set a variable "longpaths" as true in our local git config file under core section.
You can navigate to it at path
<git-repo>\.git\config
alternatively you can clone your code using git bash with below command
git clone -c core.longpaths=true <repo-url>
If command git config core.longpaths true
not worked then try changing it manually.
Go to .git
folder of your project (make sure you are enabled hidden items view in file explorer) and Open the config
file. File content will look like below
[core]
repositoryformatversion = 0
filemode = false
bare = false
logallrefupdates = true
symlinks = false
ignorecase = true
hideDotFiles = dotGitOnly
[remote "origin"]
url = https://<domain>/scm/<project>/<repo>.git
fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
remote = origin
merge = refs/heads/master
Add longpaths = true
property manually under [core]
section. Save it and try pulling the code from fresh git bash session. It will solve the issue.
[core]
repositoryformatversion = 0
filemode = false
bare = false
logallrefupdates = true
symlinks = false
ignorecase = true
hideDotFiles = dotGitOnly
longpaths = true
Instead of git config --system core.longpaths true
try ,
git config --global core.longpaths true ,
--system
will set the variables for all users on the system , but what you are looking for is to the set it for currently logged in user .
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.