Comments (6)
There's nothing built-in to do this, and it seems a bit dangerous to add because a temporary issue with the remote (like a permissions issue) would cause your local copy to get deleted. You also need to consider situations with multiple remotes or when we have branches out of sync with the remote we can't update. Basically, I'm not sure what a "safe" check for this would look like.
from git-repo-updater.
Maybe I'm not using this application for it's intended purpose? At my work, we have around 500 repos. With that many, they get moved or deleted fairly often and the only way for me to fix it is to find them by hand and manually delete them.
Do you have any suggestions for how I can remove these deleted repos?
from git-repo-updater.
Something like this will work:
gitup . -e 'bash -c "git ls-remote --exit-code >/dev/null 2>&1 || (rm -rf $(git rev-parse --show-toplevel) && echo deleted)"'
Just keep in mind that it's inherently very dangerous if you are ever unable to access the remote for some reason.
from git-repo-updater.
At the very least you can check that the remote server answers on port 22 or 443 (depending on if you use ssh or https) by grepping the config in .git
and testing with nc
. Just to make sure it's not just the server being offline.
But if you want to try and get all the edge cases (ssh key not in the keychain/agent anymore, temporary access issue, etc. etc.) it's going to be real hard.
Also it doesn't sound fun working at a company that things having 500 git repos is a good idea :-D
You could have a process that "quarantine" these repos. Move them to a secondary folder you can recover them from. And then have a cron job that deletes them after x days based on mtime.
from git-repo-updater.
Ha. That's a creative approach. Thank you. I'm currently running gitup on a Windows machine so I'll install it on a unix machine and give this a shot. Thanks for taking the time to answer the question.
Something like this will work:
gitup . -e 'bash -c "git ls-remote --exit-code >/dev/null 2>&1 || (rm -rf $(git rev-parse --show-toplevel) && echo deleted)"'
Just keep in mind that it's inherently very dangerous if you are ever unable to access the remote for some reason.
from git-repo-updater.
gitup -n will clean up it's bookmarks file for repo's that are no longer there.
from git-repo-updater.
Related Issues (20)
- “PackingType of packed-Refs not understood” HOT 5
- Homebrew Installation Requires Python@2 HOT 3
- Quiet mode - hide repos that are already up to date HOT 2
- Option to ignore some folders on recursive search for git repositories HOT 1
- [feature request] Package Manager Install HOT 4
- PyPI install? HOT 2
- git push? HOT 2
- Add a command to list repositories which have commits recently HOT 3
- Prune and current directory doesn't work? HOT 4
- new release HOT 2
- running tests HOT 1
- Is there a way we can set which branch to pull update? HOT 2
- ImportError: No module named configparser HOT 5
- Incompatible with PyOxidizer HOT 3
- Earwig/git-repo-updater
- error: Could not read from remote repository - fails at different point each time HOT 3
- [Suggestion] Add topics to the GitHub repo HOT 1
- Migration to Github Action HOT 2
- [FEATURE] - Option to exclude directory / directories HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from git-repo-updater.