问题
I'm getting an error when cloning a bitbucket-hosted repository to my computer.
When I enter in git bash:
git clone https://myusername@bitbucket.org/groupname/repositoryname.git
I get the message
Cloning into 'repositoryname'..
fatal: bad config line 1 in file U://.../repositoryname/.git/config
Unlink of file 'repositoryname/.git/config' failed.
Should I try again? (y/n)
The destination folder contains a .git
subfolder, which itself contains the file config
, along with a hooks
subfolder containing various files.
The config file has the following contents:
[core]
repositoryformatversion = 0
filemode = false
Trying again by hitting y accomplishes nothing.
I am aware of a similar question asked earlier: Bad git config file .git/config, but that had to do with a repository that was being worked on.
This is a problem with even getting started, so I'm at a loss to see what to do.
In case my .gitconfig
file is considered as a possible source of the error, here its contents:
[user]
name = ...
email = ...
回答1:
Please check if you are cloning on a network drive, it is probably not working because of that.
If you can, please just switch to local machine.
If you really need to clone on a network drive please check if the problem is caused by hardlinks by using the --no-hardlinks option:
git clone --no-hardlinks /path/to/your/repository
NB: usually this happens if your HOMEDRIVE
/ HOMESHARE
environmental variables are set on a network drive and you clone for the first time.
来源:https://stackoverflow.com/questions/47750087/bad-config-line-1-in-config-file-when-cloning