How do I clone into a non-empty directory?

前端 未结 16 1295
庸人自扰
庸人自扰 2020-11-22 06:20

I have directory A with files matching directory B. Directory A may have other needed files. Directory B is a git repo.

I want to clone directory B to directory A bu

16条回答
  •  盖世英雄少女心
    2020-11-22 06:34

    I was looking for something similar, and here's what I came up with:

    My situation is one where I have an active web tree and I was trying to create a remote repository for it without moving any of the files in the current web tree. Here's what I did:

    1. Go to the web tree and run git init
    2. Go to the intended location of the repository and run: git clone --bare /path/to/web/repo
    3. Edit the config file in my remote repo and remove the [remote "origin"] section.
    4. Add a [remote "origin"] section to .git/config in the web tree pointing to the new remote repo.

提交回复
热议问题