3
3
3098482021-05-26 18:46:07
git
309848, 2021-05-26 18:46:07

How to make a git repository in a different directory?

Hello!

I want to make a GIT repository 1 level above the working directory of the project. I understand that most likely you need to dig towards the worktree, but something does not take off ((

For example, the working directory is /home/project/public_htm/, and the repository for it needs to be made in /home/project/git/

UPD - a solution was found: edit the .git/config file in the repository, specify the desired directory:
[core]
bare = false
worktree = /home/project/public_htm/,

Answer the question

In order to leave comments, you need to log in

3 answer(s)
B
BorLaze, 2021-05-26
@BorLaze

a repository for it needs to be made in /home/project/git/

and already in it public_htm?
do it where you need it, and in /home/project make a public_htm symlink to the desired directory

L
Lynn "Coffee Man", 2021-05-26
@Lynn

Dig towards GIT_DIR git-scm.com/book/en/v2/Git-Internals-Environment-V...

3
309848, 2021-05-26
@309848

Edit the .git/config file in the repository, specify the desired directory:
[core]
bare = false
worktree = /home/project/public_htm/

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question