【问题标题】:Cloning gitlab project repository adding additionaly directory which is not in repository itself克隆 gitlab 项目存储库添加不在存储库本身中的附加目录
【发布时间】:2020-12-06 15:47:06
【问题描述】:

我遇到了从 gitlab 克隆存储库按存储库名称创建附加文件夹的问题。

我在服务器上有 django 项目,路径如下

tutor #project contained folder
|__env #virtualenv created folder
|__tute #project folder itself
   |__manage.py
   |__tute #project settings

我创建了名为 repository 的 gitlab 存储库,作为 tutorize 将项目推送到 repo

在我的本地机器上,我创建了一个文件夹来克隆 gitlab repo 到它

mkdir tutor #create folder to store project inside it
cd tutor
virtualenv env #create virtualenv
. env/bin/activate #activated it
git init #initiated git 
git clone my_tutorize_repo_url #cloned repo inside tutor folder 

我得到了以下文件夹结构

tutor #folder locally created
|__env #virtualenv folder
|__tutorize #folder which is not on my server and i didnt create it localy. Its my project repository name on gitlab
   |__tute #project foldet
      |__manage.py
      |__tute #project settings

在我期待的时候

tutor
|__env
|__tute
   |__manage.py
   |__tute

这是对的行为还是我做错了什么??

【问题讨论】:

  • 项目所需的一切都应该在 repo 文件夹中。如果您不想推送 smth,您可以随时将其添加到 .gitignore 文件中。 (在你的情况下 env 的东西)
  • 但是我的问题不在于 env 我配置了我的 .gitignore 以便不要将 env 克隆到 repo。问题是文件夹是我创建 repo 时由 gitlab 自己创建的存储库名称

标签: git gitlab


【解决方案1】:

要克隆 git 存储库而不克隆存储库名称,您可以按照以下方式进行操作 git clone [repository] [local path] 重要注意本地目录应该为空

【讨论】:

    猜你喜欢
    • 2012-05-06
    • 1970-01-01
    • 2019-12-02
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-01-19
    • 2018-09-13
    • 1970-01-01
    相关资源
    最近更新 更多