简体   繁体   中英

Cant clone git repository

first-time asker here. I have an issue with git, cant clone anything. If I don't specify where to clone, this will appear.

> git clone https://gitlab.corp.cz/username/project_name.git project_name
fatal: could not create work tree dir 'project_name': No such file or directory

If I first create a folder via explorer, then the error message is different.

> git clone https://gitlab.corp.cz/username/project_name.git project_name
Cloning into 'project_name'...
C:/Users/username/Documents/project/path/.git: No such file or directory

Mkdir say the same, though not sure if windows even have a mkdir. At least a month ago, it worked. Please help, even reinstalled windows, didn't help.

EDIT: It looks like it is not a git problem. I cannot create any file using nothing other than windows explorer. Checked and I have write permissions for this folder, so most likely a windows problem.

a) You must run the command in a directory where you have write permission;

b) Add git to the list of allowed applications:

1 - Select Start > Settings > Update & Security > Windows Security > Virus & threat protection.

2 - Under Virus & threat protection settings, select Manage settings.

3 - Under Controlled folder access, select Manage Controlled folder access.

4 - Switch the Controlled folder access setting to On or Off.

c) If that doesn't work, try running the terminal with the administrator.

If you are using WSL (Windows Subsystem for Linux) to execute this command in the terminal check if the linux user has permissions to create a new folder there or try doing it as root.

If you are using Powershell or the Command Prompt try running it as Administrator and check if cloning a repo will work.. if this works there is a problem with your permissions. In this case try to change your working path so if the folder you are trying to clone a repo is in "C:\Program Files" or "C:\Program Files (x86)" try cloning to another place as these paths cause problems.

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM