简体   繁体   English

无法克隆 git 存储库

[英]Cant clone git repository

first-time asker here.第一次在这里提问。 I have an issue with git, cant clone anything.我对 git 有疑问,无法克隆任何东西。 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. Mkdir 也这么说,但不确定 windows 是否有 mkdir。 At least a month ago, it worked.至少一个月前,它奏效了。 Please help, even reinstalled windows, didn't help.请帮忙,即使重新安装了 windows,也没有用。

EDIT: It looks like it is not a git problem.编辑:看起来这不是 git 问题。 I cannot create any file using nothing other than windows explorer.除了 windows 资源管理器之外,我无法创建任何文件。 Checked and I have write permissions for this folder, so most likely a windows problem.检查,我有这个文件夹的写权限,所以很可能是 windows 问题。

a) You must run the command in a directory where you have write permission; a)您必须在您有写权限的目录中运行该命令;

b) Add git to the list of allowed applications: b)将 git 添加到允许的应用程序列表中:

1 - Select Start > Settings > Update & Security > Windows Security > Virus & threat protection. 1 - Select 开始 > 设置 > 更新和安全 > Windows 安全 > 病毒和威胁防护。

2 - Under Virus & threat protection settings, select Manage settings. 2 - 在病毒和威胁防护设置下,select 管理设置。

3 - Under Controlled folder access, select Manage Controlled folder access. 3 - 在受控文件夹访问下,select 管理受控文件夹访问。

4 - Switch the Controlled folder access setting to On or Off. 4 - 将受控文件夹访问设置切换为开或关。

c) If that doesn't work, try running the terminal with the administrator. c)如果这不起作用,请尝试使用管理员运行终端。

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.如果您使用 WSL(Linux 的 Windows 子系统)在终端中执行此命令,请检查 linux 用户是否有权在此处创建新文件夹或尝试以 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.如果您使用的是 Powershell 或命令提示符,请尝试以管理员身份运行它并检查克隆存储库是否有效。如果这样有效,则说明您的权限有问题。 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.在这种情况下,请尝试更改您的工作路径,因此如果您尝试克隆存储库的文件夹位于“C:\Program Files”或“C:\Program Files (x86)”中,请尝试克隆到另一个位置,因为这些路径会导致问题.

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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