我可以将GIT遥控器标记为只读吗? [英] Can I mark a GIT remote as read only?

查看:97
本文介绍了我可以将GIT遥控器标记为只读吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有读/写GitHub回购的权限。我有一个当地的回购克隆。我希望能够从那个遥控器中获取更改,但我绝不应该对它进行更改。



有没有办法将遥控器标记为只读?只有这样我才不会意外地输入错误的命令并推送到它? 您可以通过

关闭默认推送>

  git config push.default nothing 

或者为了在特定的遥控器上提供更强的保护,您可以完全通过例如电话线将其打破

  git config remote.origin.pushurl你真的不想这样做


I have read/write access to a repo on GitHub. I have a local clone of that repo. I'd like to be able to pull changes from that remote, but I should never push changes to it.

Is there a way I can mark the remote as read-only so I never accidentally type in the wrong command and push to it?

解决方案

You could shut off default pushes via

git config push.default nothing

or for stronger protection on a specific remote you could break pushes to that remote entirely by e.g.

git config remote.origin.pushurl "you really didn't want to do that"

这篇关于我可以将GIT遥控器标记为只读吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆