简体   繁体   English

如何从github服务器在我的服务器上创建git存储库?

[英]How to create a git repository on my server from the github server?

I admit the question isn't crystal clear.. 我承认这个问题不清楚。

I am cloning a github hosted project(askbot). 我正在克隆一个github托管项目(askbot)。
I want to create my private repository for this project so that my team members can make modifications. 我想为此项目创建私有存储库,以便我的团队成员可以进行修改。

I also want to be able to fetch(or pull) new updates from the original github repository(the project will have new features and bug fixes and so on) 我还希望能够从原始github存储库中获取(或提取)新更新(该项目将具有新功能和错误修复等)

In short, I want a repository that we can push/pull privately and that we can also pull from the original github repository. 简而言之,我想要一个存储库,我们可以私下推/拉,也可以从原始的github存储库中提取。
Are there special setup needed for this? 是否需要为此进行特殊设置?

git clone will create a full fledged repository. git clone将创建完整的存储库。 you can work at it, pull from it and push changes to it. 您可以对其进行处理,从中拉出并推送更改。

The only problem is, that you cannot push to the currently checked out branch. 唯一的问题是,您不能推送到当前签出的分支。 To solve this you can set up a --bare repository, which has no branch checked out. 为了解决这个问题,您可以设置--bare存储库,该存储库没有签出任何分支。

You also have to decide, how to access you repository. 您还必须决定如何访问存储库。 You can use ssh, git-daemon, or a wrapper like gitolite. 您可以使用ssh,git-daemon或gitolite之类的包装器。

On your working copy you can set up two remotes. 在工作副本上,您可以设置两个遥控器。 One for the upstream and one you your clone. 一个用于上游,另一个则是您的克隆。
This allows you to fetch updates from upstream, merge them in your own work, and push it back to your clone. 这使您可以从上游获取更新,将更新合并到自己的工作中,然后将其推回克隆中。

Hence: 因此:

  • decide where to put your private repository and how to access it 决定将私有存储库放置在何处以及如何访问它
  • use git clone --bare $upsteam to create the private repository 使用git clone --bare $upsteam创建私有存储库
  • Clone your working copy for the private repository, creating remote "origin" 克隆私有存储库的工作副本,创建远程“源”
  • use git remote add to add another remote "upstream" 使用git remote add添加另一个远程“上游”
  • have fun 玩得开心

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

相关问题 从github克隆了一个git仓库-我如何在我的账户中创建一个新的github仓库 - cloned a git repository from github - how do i create a new github repository into a repository into my account 如何从GitHub重新创建本地git存储库 - How to re-create my local git repository from GitHub 在使用GIT的服务器上创建存储库树 - Create a repository tree on my server working with GIT 如何将Git服务器存储库问题推送到Github存储库? - How to push a Git server repository issues to Github repository? 在服务器端创建一个git存储库 - Create a git repository on server side 如何从客户端将GIT存储库还原到服务器 - How to restore a GIT repository to a server from a client 如何从远程服务器中提取git存储库? - How to pull a git repository from remote server? GIT:如何在WHM Centos服务器上创建git存储库并与SourceTree连接 - GIT: How to create git repository on WHM Centos server and connect with SourceTree 如何使用 Eclipse EGit 从我的服务器 git 存储库下载/克隆一个新分支到我 PC 中已经创建的本地 git 存储库 - How to download/clone a new branch from my server git repository into an already created local git repository in my PC with Eclipse EGit 如何使用 git 仅使用令牌从 cli 创建 github 存储库? - How to create a github repository from the cli with git using only a token?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM