DEV Community

Cover image for 1 line to prevent pushing to someone else's git repository
Nočnica Mellifera for RudderStack

Posted on

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

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!

Top comments (1)

Collapse
 
thtmnisamnstr profile image
Gavin

NGL I’m going to use this.