简体   繁体   English

如何从不同的Git存储库远程推送另一个Git存储库?

[英]How to remote push in another Git repository from different Git repository?

I've checked out read-only Git repository, which is published by someone else for learning purpose. 我已经签出了只读的Git存储库,该存储库由其他人发布以供学习。 Now, I'm making some changes in local for learning and I've created local branches for different changes. 现在,我在本地进行一些更改以供学习,并且为不同的更改创建了本地分支。

I cannot push those branches to remote as it's not my repository (no write permission). 我不能将那些分支推送到远程,因为它不是我的存储库(没有写权限)。 If I try then get this error: 如果我尝试然后得到此错误:

git-receive-pack not permitted git-receive-pack不允许

What I want is, I can push changes so I can save and access those changes remotely from anywhere. 我想要的是,我可以推送更改,以便可以从任何地方远程保存和访问这些更改。 I've created my own Git repository but I've not much experience with Git, so not sure how can I save my changes from current repository to my repository. 我已经创建了自己的Git存储库,但是对Git的使用经验不多,所以不确定如何将所做的更改从当前存储库保存到存储库中。

Also, is it possible that I can continue working in the same remote repository (because sometimes I've to pull changes to remote repository from where I'm learning) and I can push remotely to my repository? 另外,是否有可能我可以继续在同一个远程存储库中工作(因为有时我必须将更改从学习的地方拉到远程存储库中)并且可以远程推送到我的存储库中?

You're probably trying to fork the repository. 您可能正在尝试分叉存储库。

A fork is a copy of a repository. 分支是存储库的副本。 Forking a repository allows you to freely experiment with changes without affecting the original project. 分叉存储库使您可以自由地进行更改试验,而不会影响原始项目。

叉子

You can continue to pull and merge changes from the original repo, and send pull requests if you've made improvements. 您可以继续拉取并合并原始存储库中的更改,如果进行了改进,则可以发送拉取请求。

网址

After pressing the fork button, update your remote using the clone URL: 按下fork按钮后,使用克隆URL更新您的遥控器:

git remote add upstream https://github.com/coolzero/infinity.git

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

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