简体   繁体   English

GitHub Clone-如何防止拉取请求进入原始存储库?

[英]GitHub Clone - how to prevent pull requests from going to the original repository?

I am going to clone a GitHub repo, and as per their instructions: 我将克隆GitHub存储库,并按照他们的说明进行操作:

git clone --depth 1 https://github.com/mgechev/angular2-seed.git my-proj git clone --depth 1 https://github.com/mgechev/angular2-seed.git my-proj

The additional steps I usually do after this, to prevent my updates from going back to that project, are: 在此之后,我通常会执行以下其他步骤,以防止我的更新返回该项目:

rd .git /S/Q  (this removes the git links to the mgechev repo)
git init
git add .
git commit -m "Initial commit"
git remote add origin <my new repo address on github>
git push -u origin master

Are these steps necessary for me to prevent my subsequent branch creation, pull requests to my master etc from going to the original repo? 这些步骤是否对我来说是必要的,以防止我以后创建分支,将请求拉到主服务器等都转到原始存储库?

I don't want to inadvertently send request to the original repo, and I do it like this because I don't know any better to be honest. 我不想无意间将请求发送到原始存储库,而我这样做是因为,老实说,我不知道有什么更好的选择。 It's just that none of the clone/fork instructions in the Readme files of repos have these steps, and I had to go looking for them. 只是回购自述文件中的所有克隆/分支说明都没有这些步骤,因此我不得不去寻找它们。 So I don't know if I'm doing something unnecessary 所以我不知道我是否在做不必要的事情

You'll lose all your history that way. 这样您将失去所有历史记录。 Better to just change the url for the remote 最好只是更改遥控器的URL

git remote set-url origin <my new repo address on github>

Now the old url is no longer a part of the repository, so it's impossible to accidentally push there. 现在,旧的url不再是存储库的一部分,因此不可能不小心将其推送到存储库中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM