Це дуже просто. Git не хвилює, як називається його каталог. Його хвилює лише те, що всередині. Тож ви можете просто зробити:
# copy the directory into newrepo dir that exists already (else create it)
$ cp -r gitrepo1 newrepo
# remove .git from old repo to delete all history and anything git from it
$ rm -rf gitrepo1/.git
Зверніть увагу, що копія є досить дорогою, якщо сховище велике та має довгу історію. Ви також можете цього легко уникнути:
# move the directory instead
$ mv gitrepo1 newrepo
# make a copy of the latest version
# Either:
$ mkdir gitrepo1; cp -r newrepo/* gitrepo1/ # doesn't copy .gitignore (and other hidden files)
# Or:
$ git clone --depth 1 newrepo gitrepo1; rm -rf gitrepo1/.git
# Or (look further here: http://stackoverflow.com/q/1209999/912144)
$ git archive --format=tar --remote=<repository URL> HEAD | tar xf -
Після створення newrepoпункт призначення gitrepo1може бути де завгодно, навіть усередині, newrepoякщо ви цього хочете. Це не змінює процедуру, а лише шлях, який ви переписуєте gitrepo1.
mv girepo1 newrepo??