How To Remove Git Repo From Local
When a user clones a Git repository from Github using the command git clone <url>, they get a re-create of the remote repo on their local figurer so that they can work on it on their current working directory where the repo got cloned without directly making changes on the remote repository.
If yous want to delete a local Github Repository that was cloned from to local calculator without touching or making whatever changes to the Remote GitHub repository then follow the commands below:
Footstep ane: Become into your projection file
cd <project_name>
rm -rf <repository_folder>.git
With the deletion of the '.git' file, this will delete the .git file that contains a log of the commit history, its information, and likewise remote repository address from the working directory. Nosotros tin can recollect of this deletion equally when we practice git init to initialize the current working directory as Git directory, with the to a higher place command we are just reverting it dorsum to not existence a Git directory.
Then what virtually the files and folder in the present working directory?
This has to be deleted using the post-obit ready of command:
Pace ii: (Optional if you lot desire to initialize working directory to another GitHub Repository See Additional steps below):-
Go to the directory where the projection is present (Notation: Don't get inside the project file).
rm -rf <folder_name>
What are rm and rf commands?
- In Linux, the user can delete/remove directories using rmdir or rm, in the above case we have made use of rm which is used to remove non-empty directories, unlike rmdir which is used to remove empty directories.
- This command is used to remove not-empty directories and all the files in the directory without being prompted if a directory or a file in the current working directory is write-protected (this instance is very common when working on forked repository from GitHub) and the user is prompted to provide Y (for yes) to confirm the deletion of the write-protected file. At present using -rf with rm is constructive as it can skip function of the user beingness prompted every fourth dimension.
Additional Steps:
Suppose you lot want to initialize (git init) a new Github repository, and then add it to a new remote repository and then commencement adding and committing to the files existence added from the current working directory.
- Make sure that the current working directory is the directory that needs to be pushed to the open-source platform (GitHub).
- git init
- git remote add origin https://github.com/user/repo.git
- git button -u origin master
Deleting the Repository from GitHub Website
Pace i: Navigate to your project
https://github.com/your-github-username/Projection-Proper name
Step two: Go to the settings option on the pinnacle right corner like the image higher up, and navigate down to the danger zone
Step three: Go and click on the delete this repository button and after which you will be prompted to make certain you lot are deleting and all these action will permanently bear upon the repository, in the box type your-username/project-name (supplant it with yours).
You may also be prompted to type in the GitHub password.
Post-obit these steps will make certain y'all accept completely deleted the repository from the local PC as well as the GitHub site.
Here we are going to delete a detail file from our github using Github. This characteristic can exist useful when we have by ,mistake added few files in our project but nosotros no longer need that.
Deleting the File from GitHub Website
Pace 1: Navigate to your project
https://github.com/your-github-username/Project-Proper noun
Step ii : Browse to the file in your repository that you want to delete.
At the top of the file, click on the Delete Icon.
Footstep 3: At the bottom of the page, type a short, meaningful commit message that describes the modify you made to the file
So it will show a alert like this that the File successfully deleted.
Source: https://www.geeksforgeeks.org/deleting-a-local-github-repository/
0 Response to "How To Remove Git Repo From Local"
Post a Comment