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
git initialize remote repo
提问by bsr
I followed thispost to setup a remote git repo.
我按照这篇文章设置了一个远程 git repo。
Instead of starting from scratch,
而不是从头开始,
- I did some development in my pc1 (the repo was created with git init)
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 --bareThen, locally
cd my_project
git remote add origin [email protected]:my_project.git
git push -u origin master
- 我在我的 pc1 上做了一些开发(repo 是用 git init 创建的)
现在,我想将 repo 移动到服务器(同一子网)
ssh [email protected]
mkdir my_project.git
cd my_project.git
git init --bare然后,在本地
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 --bare
means you create a barerepository, rather than workingrepository. A bare repository usually stores at server and it looks just like your .git
directory of your working r repository.
git init --bare
意味着您创建一个裸存储库,而不是工作存储库。裸存储库通常存储在服务器上,它看起来就像您.git
的工作 r 存储库的目录。