DEV Community

loading...
Cover image for 1 line to prevent pushing to someone else's git repository
RudderStack

1 line to prevent pushing to someone else's git repository

nocnica profile image Nočnica Fee ・1 min read

cover image by D.D. Fire

The other day I attempted to push to a public repository for about the hundredth time. This time I finally thought to search for a way to prevent this happening, and of course I found the answer on stack overflow

The following command will let pulls work, but pushes will try to use the URL no_push and fail:

git remote set-url --push origin no_push
Enter fullscreen mode Exit fullscreen mode

use it in good health!

Discussion (1)

pic
Editor guide
Collapse
thtmnisamnstr profile image
Gavin

NGL I’m going to use this.