Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a file from another git repository #330

Open
TimotheeMathieu opened this issue Apr 15, 2023 · 5 comments
Open

Add a file from another git repository #330

TimotheeMathieu opened this issue Apr 15, 2023 · 5 comments
Labels

Comments

@TimotheeMathieu
Copy link

I use vcsh as an archiving tool, adding and commiting important files throughout my laptop.

My problem is that some of the files I'd like to archive are already in another git repository. I don't want to add this git repo as a submodule because this is a bit of a pain and some of these git repo are local anyway so having a submodule for this do not really make sense.

Basically my question is: is there a way to allow vcsh to add files from a folder that contains a .git ?

Thanks.

@alerque
Copy link
Collaborator

alerque commented Apr 17, 2023

Did you try just force adding it?

@TimotheeMathieu
Copy link
Author

Yes, I tried vcsh repo add --force file but vcsh status stays empty.

@RichiH
Copy link
Owner

RichiH commented Apr 18, 2023 via email

@alerque
Copy link
Collaborator

alerque commented Apr 18, 2023

I did give this a try and it didn't work as I expected it would either. No error, no code, just a silent fail to do anything at all. None of my system layouts run into this circumstance since all my VCSH things are carefully kept upstream of any actual Git repos, but I guess it should be possible to do if you really wanted to.

Just brainstorming here, but this may have to do with recent changes to Git's security precautions, although I would have expected an error...

@jakebman
Copy link

Temporarily renaming the .git folder of the "donor" repository seems to be a temporary workaround if you need it, @TimotheeMathieu. Once the file is tracked by your vcsh repo, it remains tracked even if its contents change.

This appears to be submodules behavior trying to step in and getting confused. Adding the root directory of the donor repo seems to produce a cleaner error:

warning: adding embedded git repository: projects/vcsh
hint: You've added another git repository inside your current repository.
hint: Clones of the outer repository will not contain the contents of
hint: the embedded repository and will not know how to obtain it.
hint: If you meant to add a submodule, use:
hint:
hint:   git submodule add <url> projects/vcsh
hint:
hint: If you added this path by mistake, you can remove it from the
hint: index with:
hint:
hint:   git rm --cached projects/vcsh
hint:
hint: See "git help submodule" for more information.

@alerque alerque added the bug label May 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants