¿Cómo eliminar completamente un repositorio git creado con init?


He creado un repositorio git con git init. Me gustaría eliminarlo por completo e iniciar uno nuevo.

 1231
Author: jww, 2009-07-31

18 answers

Git mantiene todos sus archivos en el directorio .git. Solo quita esa y vuelve a iniciarla.

Si no puedes encontrarlo, es porque está oculto.

  • En Windows 7, debe ir a su carpeta, haga clic en Organizar en la parte superior izquierda, luego haga clic en la carpeta y las opciones de búsqueda, luego haga clic en la pestaña Ver y haga clic en el botón de radio Mostrar archivos ocultos, carpetas y unidades.

  • En un Mac OS:

    • Abra un Terminal (a través de Spotlight: presione CMD + SPACE, escriba terminal y presione Enter) y haga este comando: defaults write com.apple.finder AppleShowAllFiles 1 && killall Finder.

    • O también puedes escribir cd (el espacio es importante), arrastrar y soltar tu carpeta git repo desde Finder a la ventana de terminal, presionar return, luego escribir rm -fr .git, luego return de nuevo.

  • En Ubuntu, use atajo Ctrl + H .

 1672
Author: Kristof Provost,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2015-12-02 15:00:14

Si realmente desea eliminar todo el repositorio, dejando solo el directorio de trabajo, entonces debería ser tan simple como esto.

rm -rf .git

Se aplican las condiciones habituales sobre rm -rf. Asegúrese de tener una copia de seguridad actualizada y esté absolutamente seguro de que está en el lugar correcto antes de ejecutar el comando. sucesivamente., sucesivamente.

 659
Author: CB Bailey,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2009-07-31 16:08:52

Si desea eliminar todo .las carpetas de git en un proyecto usan el siguiente comando:

find . -type f | grep -i "\.git" | xargs rm

Esto también eliminará todos los .git carpetas y .gitignore archivos de todas las subcarpetas

 57
Author: ejazz,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2014-02-06 15:15:21

Alternativa a matar a TortoiseGit:

  • Abra TortoiseGit-Settings (haga clic derecho en cualquier carpeta, TortoiseGit → Settings)
  • Vaya a la opción Iconos Superpuestos.
  • Cambie la Caché de estado de Predeterminada a Ninguna
  • Ahora puede eliminar el directorio (ya sea con el explorador de Windows o rmdir /S /Q)
  • la Estado de la Caché de None a Default y usted debería estar bien nuevo...
 15
Author: eckes,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2013-03-10 18:50:56

Cd al directorio desde el que git necesita ser eliminado y ejecutar command

Mac OS o cualquier distribución de Linux

rm -rf .git
 15
Author: kamal,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2016-01-13 16:57:56

Donde $GIT_DIR es la ruta a la carpeta a buscar (la ruta de repositorio de git), ejecute lo siguiente en terminal.

find $GIT_DIR -name *.git* -ok rm -Rf {} \;

Esto buscará recursivamente cualquier directorio o archivo que contenga ".git " en el nombre del archivo / directorio dentro del directorio Git especificado. Esto incluirá .git / and .archivos gitignore y cualquier otro .activos similares a git. El comando es interactivo y preguntará antes de quitar. Para continuar con la eliminación, simplemente ingrese y, luego Ingrese.

 9
Author: Scorpius,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2012-08-14 17:06:55

Puede usar el siguiente comando desde la línea de comandos-

rm -rf .git

Aquí rm significa eliminar, -rf significa fuerza recursiva y .git es el archivo/repo que desea eliminar. Tenga cuidado al usar este comando. Si ha intentado rm -rf cualquier otro archivo o carpeta, pueden ser eliminados permanentemente. Nunca ejecute esto en su escritorio. Puedes borrar todo tu trabajo. Tenga cuidado al usar este comando.

 7
Author: Urvashi Gupta,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2016-11-11 05:44:36

Ejecutar

rm -rf .git

En tu carpeta repo

 5
Author: Frosted Developer,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2018-07-26 14:08:17

Solo recojo los que funcionan mejor para mí:

cd <repository-name>
find . -type f | grep -i "\.git" | xargs rm
cd ..
rm -rf <repository-name>
mkdir <repository-name>
cd <repository-name>
git init
 3
Author: Chetabahana,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2016-06-02 05:30:26

Puede crear un alias para él. Estoy usando ZSH shell con Oh-my-Zsh y aquí hay un alias útil:

# delete and re-init git
# usage: just type 'gdelinit' in a local repository
alias gdelinit="trash .git && git init"

Estoy usando Trash para eliminar la carpeta .git ya que usar rm es realmente peligroso:

trash .git

Entonces estoy re-inicializando el repositorio git:

git init
 2
Author: Ahmad Awais,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2015-12-02 14:37:52

Hice esto, y funcionó muy bien.
1. Retire el .archivo git del repositorio por rm -fr .git
2. Eliminar la carpeta repo por rm -R path\your_repo_name

 2
Author: amritpandey,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2017-06-24 12:50:12

Para eliminar completamente el repositorio .git en su computadora (en Windows 8 y superiores):

  1. El repositorio .git normalmente está oculto en windows
  2. Por lo que debe marcar los "elementos ocultos" para mostrar las carpetas ocultas
  3. En el sitio superior de su directorio se encuentra la opción" ver "
  4. Dentro de la opción " ver " se encuentra "elementos ocultos" y marcarlo
  5. Luego ves el repositorio .git luego puedes eliminarlo
 1
Author: squal,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2017-08-07 16:50:45

Lo intenté:

rm -rf .git y también

Git mantiene todos sus archivos en el .directorio git. Sólo quita uno e init de nuevo.

Ninguno funcionó para mí. Esto es lo que hizo:

  • Eliminar todos los archivos excepto .git
  • git add . - A
  • git commit-m "eliminado todo el proyecto"
  • git push

Luego crea / restaura el proyecto desde la copia de seguridad:

  • Crear nuevos archivos de proyecto (o copiar y pegar un copia de seguridad)
  • git add . - A
  • git commit-m"proyecto recreado"
  • git push
 0
Author: P.Brian.Mackey,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2015-02-04 18:24:52

En windows:

  1. Presione el botón de Inicio
  2. Monitor de Recursos de Búsqueda
  3. En la pestaña CPU -> type .git - > haga clic derecho en rundll32 y finalice el proceso

Ahora puede eliminar .git folder

 0
Author: sahil khurana,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2017-11-08 05:14:24

Mensaje cmd de Windows: (Puede probar el siguiente comando directamente en windows cmd si no se siente cómodo con grep, rm-rf, find, xargs, etc., comandos en git bash )

Suprimir .git recursivamente dentro de la carpeta del proyecto mediante el siguiente comando en cmd:

FOR /F "tokens=*" %G IN ('DIR /B /AD /S .git') DO RMDIR / S / Q "% G "

 0
Author: SridharKritha,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2018-01-29 16:49:36

Solución para Eliminar uno o varios repositorios con respaldo.

Como han mencionado muchos otros. la forma más fácil es usar por @CBbailey rm -rf .git desde mac o linux.

Sin embargo, si desea eliminar varios repositorios git y también hacer una copia de seguridad de ellos.

Puedes probar https://github.com/Peripona/bulk-clean-repos

 0
Author: Tarandeep Singh,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2018-09-06 09:28:31

U también puede eliminar estas carpetas y archivos donde u tiene un repositorio git

Http://storage9.static.itmages.com/i/16/0410/h_1460324963_2968655_d38544bf73.png

 -3
Author: user2340356,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2016-04-10 21:51:03
  • Remove /var/www/gitorious (o donde lo instalaste)
  • Eliminar servicios en /etc/monitd
  • Eliminar usuario de git
  • Eliminar /usr/local/activemq y el script de inicio para ello en /etc/init.d/act
 -24
Author: Tolga Yılmaz,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2014-05-27 11:35:51