只有.git 目录如何将其配置为远程仓库

2015-08-19 17:32:20 +08:00
 yonglanyouyou
手头有一个从别人手中拿到的工程,只给了.git 文件夹。我在本地使用的时候只需要 checkout 一下就完了。
现在我想把这个.git 变成正常使用的远程仓库,保留原有的提交记录。我该如何操作?
3712 次点击
所在节点    git
7 条回复
Mirana
2015-08-19 17:34:45 +08:00
放到服务器上,就行了把

远程仓库和本地仓库没有区别
gangsta
2015-08-19 17:44:19 +08:00
这个可以么?
git remote add origin https://github.com/username/yourrepo.git
inmyfree
2015-08-19 17:46:32 +08:00
可以的
先 git remote add origin https://github.com/username/yourrepo.git
如果提示已经存在了,则先
git remote rm origin
再执行
git remote add origin https://github.com/username/yourrepo.git
然后 git push 就会提交到远程仓库了
flowfire
2015-08-19 19:48:28 +08:00
我记得 git 官网是有教程的。。。。叫你做个裸仓库放到服务器上。。。
倒是我上次弄非裸仓库的时候折腾的要死
shmilyin
2015-08-19 21:02:24 +08:00
git remote -v
如果没有 就
git remote add origin https://github.com/username/yourrepo.git

如果有 就
git remote set-url origin https://github.com/username/yourrepo.git
johnnyb
2015-08-20 01:27:45 +08:00
放到你能访问到的任何地方:(本机)另一个目录,局域网,或者公网。协议无所谓,本地路径/ smb / ssh / http 都可以。

你通过什么路径访问,就在项目目录下 add 那个路径
sinsin
2015-08-20 16:36:33 +08:00
假如你的仓库(.git 文件夹所在文件夹)名为 foo
在它上一级目录下执行:
git clone --bare foo
就会产生一个 foo.git 的裸仓库。
这个裸仓库就是可以正常使用的远程仓库(惯例仓库目录名有.git 后缀)

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/214351

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX