简体   繁体   English

将本地git存储库与现有存储库链接

[英]Link a local git repository with an existing repository

I'm working on a C project with some friends for school. 我正在和一些朋友一起上学进行C项目。 They helped me to set up everything on my debian partition but I would like to do the same things with Windows. 他们帮助我在debian分区上设置了所有内容,但是我想在Windows上做同样的事情。 I created an empty local repository but now I would like to "link" it with our project so that I can commit on my branch. 我创建了一个空的本地存储库,但现在我想将其“链接”到我们的项目,以便可以在分支上进行提交。

How can I do that ? 我怎样才能做到这一点 ?

You need not create an empty local repository. 您无需创建一个空的本地存储库。 Just clone the origin again on your windows partition ( git clone url://to/origin ). 只需在Windows分区上再次克隆源( git clone url://to/origin )。

If you don't know the url for origin, you can try the following steps (after adapting for your local setup). 如果您不知道原始网址,则可以尝试以下步骤(在适应本地设置之后)。

On your Debian partition: 在您的Debian分区上:

cd <working directory>
git config --get remote.origin.url

The url given by the second command is your url for origin. 第二个命令给出的URL是您的原始URL。 Then on your Windows partition you can do git clone <url you got above> . 然后在Windows分区上,您可以执行git clone <url you got above>

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

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