Удалить репозиторий git linux

How do I delete a local repository in git? [duplicate]

Delete the .git directory in the root-directory of your repository if you only want to delete the git-related information (branches, versions).

If you want to delete everything (git-data, code, etc), just delete the whole directory.

.git directories are hidden by default, so you’ll need to be able to view hidden files to delete it.

This WOULD delete the files if they aren’t in use, but so long as Git locks them, it won’t work so this does not answer «how to delete a local repo».

How do you ‘close your Git app’? Anyway, it’s seemingly about permission rather than app lockdown. In Ubuntu: sudo rm -r directory .

To piggyback on rkj’s answer, to avoid endless prompts (and force the command recursively), enter the following into the command line, within the project folder:

Or to delete .gitignore and .gitmodules if any (via @aragaer):

Then from the same ex-repository folder, to see if hidden folder .git is still there:

If it’s not, then congratulations, you’ve deleted your local git repo, but not a remote one if you had it. You can delete GitHub repo on their site (github.com).

To view hidden folders in Finder (Mac OS X) execute these two commands in your terminal window:

defaults write com.apple.finder AppleShowAllFiles TRUE killall Finder 

It’s not only to avoid prompts, rm -rf was necessary for me otherwise rm would not delete files and complain: rm: cannot remove `.git/objects/pack’: Directory not empty

» -r is for recursive» that means you tell the guy to delete the entire repo struct just because he created one in a wrong place higher in the directory structure

In the repository directory you remove the directory named .git and that’s all :). On Un*x it is hidden, so you might not see it from file browser, but

cd repository-path/ rm -r .git 

you’ll want to use «rm -rf .git» or you’ll be pressing «y» to confirm for every single file in the directory.

That’s right, if you’re on a mac(unix) you won’t see .git in finder(the file browser). You can follow the directions above to delete and there are git commands that allow you to delete files as well(they are sometimes difficult to work with and learn, for example: on making a ‘git rm -r ‘ command you might be prompted with a .git/ not found. Here is the git command specs:

-n, --dry-run dry run -q, --quiet do not list removed files --cached only remove from the index -f, --force override the up-to-date check -r allow recursive removal --ignore-unmatch exit with a zero status even if nothing matched 

When I had to do this, deleting the objects and refs didn’t matter. After I deleted the other files in the .git, I initialized a git repo with ‘git init’ and it created an empty repo.

Читайте также:  Amd linux drivers ubuntu

Источник

How to Delete Git Repository Created with Init

To undo the changes made by git init you should delete the git repository. Follow the steps below to make the job done.

  1. Open the Terminal by typing the Ctrl + Alt + T
  2. Next type the following command line which will delete the git repository and undo the changes made by git init :

Solution for Windows

The method to undo the changes for Window differs from other operating systems. Here are the steps to follow.

  1. Open the Run prompt by pressing Windows + R .
  2. Then, type cmd and press Shift + Ctrl + Enter to provide administrative privileges.
  3. Run the following to delete the repository and press Enter :

If the repository has subfolders, then execute:

Solution for Mac OS

In this section, we will demonstrate to you two ways of detecting the hidden files and deleting them in Mac OS.

    In the framework of the first method, first, you should open the terminal and run the code below:

defaults write com.apple.finder AppleShowAllFiles 1 && killall Finder

The git init Command

The git init command generates a new, empty git repository or reinitializes an existing one. A repository is a storage of the project files, which makes it possible to save code versions and have access to them. This command creates a .git subdirectory which includes the metadata, like subdirectories for objects and template files to generate a new repository.

Источник

Удалить репозиторий git linux

  • How to maintain polyglot persistence for microservices Managing microservice data may be difficult without polyglot persistence in place. Examine how the strategy works, its challenges.
  • Top developer relations trends for building stronger teams Learn about enterprise trends for optimizing software engineering practices, including developer relations, API use, community .
  • 5 noteworthy challenges of automotive software development Modern cars are loaded with technology, but creating in-vehicle applications isn’t always a cakewalk. Here are five unique .
  • The basics of implementing an API testing framework With an increasing need for API testing, having an efficient test strategy is a big concern for testers. How can teams evaluate .
  • The potential of ChatGPT for software testing ChatGPT can help software testers write tests and plan coverage. How can teams anticipate both AI’s future testing capabilities .
  • Retail companies gain DORA metrics ROI from specialist tools DORA metrics and other measures of engineering efficiency are popping up in add-ons to existing DevOps tools. But third-party .
  • How to create and manage Amazon EBS snapshots via AWS CLI EBS snapshots are an essential part of any data backup and recovery strategy in EC2-based deployments. Become familiar with how .
  • Prices for cloud infrastructure soar 30% Tough macroeconomic conditions as well as high average selling prices for cloud computing and storage servers have forced .
  • Deploy a low-latency app with AWS Local Zones in 5 steps Once you decide AWS Local Zones are right for your application, it’s time for deployment. Follow along in this step-by-step video.
  • Microsoft: Government agencies breached in email attacks While Microsoft mitigated the attacks and found no evidence of further access beyond the email accounts, the Outlook breaches .
  • The history, evolution and current state of SIEM SIEM met the need for a security tool that could pinpoint threats in real time. But new threats mean that the next evolution of .
  • Chainalysis observes sharp rise in ransomware payments The rise in total ransomware payments so far this year is a reversal of the decline Chainalysis saw in 2022, when payments fell .
  • AWS Control Tower aims to simplify multi-account management Many organizations struggle to manage their vast collection of AWS accounts, but Control Tower can help. The service automates .
  • Break down the Amazon EKS pricing model There are several important variables within the Amazon EKS pricing model. Dig into the numbers to ensure you deploy the service .
  • Compare EKS vs. self-managed Kubernetes on AWS AWS users face a choice when deploying Kubernetes: run it themselves on EC2 or let Amazon do the heavy lifting with EKS. See .
Читайте также:  Linux lite based on

Источник

Работаем с репозиториями в Git

Одна из самых распространенных систем управления версиями – Git. Ее ядро добавляет в систему ряд консольных команд, предназначенных для управления репозиториями. В самих же репозиториях хранятся важные каталоги, конфигурационные файлы, журналы и прочие связанные элементы.

Далее я расскажу, как создать, клонировать и удалить эти репозитории.

Следующие инструкции предназначены для тех, кто уже установил Git на свой сервер. Если вы еще не сделали этого, используйте руководство с GitHub, которое поможет разобраться с выполнением поставленной задачи.

Создание Git-репозитория

Сначала рассмотрим создание репозитория. Представим, что у вас уже есть папка для хранения файлов, но она еще не находится под контролем Git.

Откройте «Командную строку‎» (Windows) или Терминал (Linux/macOS) и перейдите по пути данной папки.

Команда для перехода по пути установки Git-репозитория

В Linux выполните команду:

Остается только ввести нижеуказанную команду, чтобы завершить первый этап.

Команда для установки локального Git-репозитория

Благодаря этой команде создается структура подкаталога со всеми необходимыми файлами. Кстати, все они расположены в подпапке с названием .git . Пока что проект не находится под контролем учета версий, поскольку в него добавлены только нужные элементы для работы Git. Для добавления файлов в репозиторий будем использовать git add. Команда git commit является заключительной:

git add git commit -m 'initial project version'

Теперь у вас есть Git-репозиторий со всеми необходимыми составляющими и отслеживаемыми файлами.

Клонирование существующего репозитория

Второй вариант создания директории для контроля версий – копирование существующего проекта с другого сервера. Это актуально, когда осуществляется доработка готового проекта или вы желаете внедрить его компоненты в свой. В этом поможет команда git clone , о которой и пойдет речь далее.

При использовании упомянутой команды вы получаете клоны всех версий файлов, а значит, можете использовать любые из них, если что-то пойдет не так. Это же пригождается, когда требуется вернуть предыдущую версию проекта, что осуществимо благодаря файлам, помещенным под версионный контроль.

Читайте также:  Linux распаковать папку zip

Для клонирования существующего репозитория понадобится ввести git clone . Пример такой команды вы видите ниже:

git clone https://github.com/rep/rep

Данная команда позволила вам получить клон всех версий указанного репозитория (в качестве примера было взято название rep ). Теперь на вашем сервере создана директория с указанным названием. К ней подключена поддержка контроля версий, то есть появилась папка .git .

При использовании вышеуказанной команды репозиторий клонируется с текущим названием. Если же оно должно отличаться, используйте следующую вариацию команды:

git clone https://github.com/rep/rep myrep

Завершим этот раздел статьи описанием содержимого, которое появляется в консоли при выполнении команды. Данный вывод соответствует успешному клонированию:

Cloning into 'Git'. remote: Counting objects: 46, done. remote: Compressing objects: 100% (25/25), done. remote: Total 46 (delta 7), reused 43 (delta 4), pack-reused 0 Unpacking objects: 100% (46/46), done. Checking connectivity. done.

Удаление локального Git-репозитория

Если с созданием и клонированием репозиториев все понятно, то как быть, когда папка с проектом уже существует, но в нее нужно поместить новые данные, удалив предыдущие, или когда Git-репозиторий на сервере больше не нужен. В таком случае осуществляется стандартное удаление.

В корне каталога с проектом необходимо избавиться от папки .git, о которой уже шла речь выше. Так вы удаляете только ту информацию, которая связана с Git, но сам проект остается. В Linux через Терминал вы должны перейти к каталогу с проектом и ввести следующую команду:

Еще один вариант – удаление .gitignore и .gitmodules в случае их наличия. Тогда команда меняет свой вид на:

Остается только убедиться в отсутствии скрытой папки, которая может помешать инсталляции новой. Для этого существует простая команда ls -lah , выполнить которую необходимо с указанием того же каталога.

Только что мы разобрались с основами создания, клонирования и удаления Git-репозитория. Удачи!

Источник

Оцените статью
Adblock
detector