git 初始化远程仓库

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/12065408/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 07:23:32  来源:igfitidea点击:

git initialize remote repo

git

提问by bsr

I followed thispost to setup a remote git repo.

我按照这篇文章设置了一个远程 git repo。

Instead of starting from scratch,

而不是从头开始,

  1. I did some development in my pc1 (the repo was created with git init)
  2. Now, I wanted to move the repo to a server (same subnet)

    ssh [email protected]
    mkdir my_project.git
    cd my_project.git
    git init --bare

  3. Then, locally

    cd my_project
    git remote add origin [email protected]:my_project.git
    git push -u origin master

  1. 我在我的 pc1 上做了一些开发(repo 是用 git init 创建的)
  2. 现在,我想将 repo 移动到服务器(同一子网)

    ssh [email protected]
    mkdir my_project.git
    cd my_project.git
    git init --bare

  3. 然后,在本地

    cd my_project
    git remote add origin [email protected]:my_project.git
    git push -u origin master

Now, in remote (server) repo, I see these folders

现在,在远程(服务器)存储库中,我看到这些文件夹

branches config description HEAD hooks info objects refs

分支配置描述 HEAD 挂钩信息对象参考

I was expecting/want to see the same content as my local (pc1) git repo

我期待/想要看到与我的本地 (pc1) git repo 相同的内容

bin doc src

bin 文档 src

回答by Chris Eberle

You initialized a bare repository on the remote side. What this means is that it stores the history, but doesn't have a working directory (translation -- no actual checkout of the project). The structure you're seeing is normal.

您在远程端初始化了一个裸存储库。这意味着它存储历史记录,但没有工作目录(翻译 - 没有实际签出项目)。你看到的结构是正常的。

回答by Clippit

git init --baremeans you create a barerepository, rather than workingrepository. A bare repository usually stores at server and it looks just like your .gitdirectory of your working r repository.

git init --bare意味着您创建一个存储库,而不是工作存储库。裸存储库通常存储在服务器上,它看起来就像您.git的工作 r 存储库的目录。