Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Git - how delete file from remote repository

Tags:

git

How can I delete file from remote git repository? I have a file that is just deleted from working copy local repository, and I want delete it from corresponding remote repository

like image 227
paganotti Avatar asked Mar 14 '12 11:03

paganotti


People also ask

How do I remove a file from a repository?

Simply view any file in your repository, click the trash can icon at the top, and commit the removal just like any other web-based edit. Then " git pull " on your local repo, and that will delete the file locally too.

How do I remove files from git remote and keep local?

Execute the following command: git rm --cached path/to/file . Git will list the files it has deleted. The --cached flag should be used if you want to keep the local copy but remove it from the repository.


1 Answers

If you deleted a file from the working tree, then commit the deletion:

git commit -a -m "A file was deleted" 

And push your commit upstream:

git push 
like image 62
jabal Avatar answered Oct 26 '22 20:10

jabal