简体   繁体   English

将本地git文件夹转换为远程存储库

[英]converting a local git folder as a remote repository

sorry if my question is too naive. 对不起,如果我的问题太幼稚。 Here is what i am trying to do: 这是我想做的事情:

  • I want to create a local git repo (git init )-> i did that 我想创建一个本地git repo(git init)->我做到了
  • I want to access the same form other machines using ssh -> stuck here 我想使用ssh->卡在这里访问其他计算机的相同表格
  • I have tried installing git bash , but i don't know how to configure ssh which is built in the git bash. 我已经尝试安装git bash,但是我不知道如何配置git bash中内置的ssh。
  • I did add a ssh config file using git bash and gave as my computername along with domain, since this machine is the server here. 我确实使用git bash添加了一个ssh配置文件,并将其作为我的计算机名以及域,因为这台机器是这里的服务器。
  • In the git bash guide, they are adding the public key to github, i dont want that 在git bash指南中,他们将公钥添加到github,我不希望那样

  • In short i have created a git repository by 'git init .' 简而言之,我已经通过'git init'创建了一个git仓库。

  • I want to access the same using other machines in the same domain using ssh 我想使用ssh在同一域中的其他计算机上访问同一文件

I don't know how to proceed further, Would anyone be able to help in this case ? 我不知道该如何进一步进行,在这种情况下,有人可以提供帮助吗?

I'd create a --bare repository somewhere accessible via SSH and push , fetch , merge , pull to and from that repository by adding a remote origin to the ones you created. 我将创建一个--bare存储库,该存储库可通过SSH进行访问,并通过向您创建的存储库添加远程源, merge pushfetchmergepull往返该存储库。

Something like 就像是

/home/git $ git init --bare your_repository.git

/your/current/repository $ git remote add origin /home/git/your_repository.git

And from another machine 并从另一台机器

/client/path $ git init
/client/path $ git remote add origin user@server:/home/git/your_repository.git
/client/path $ git pull origin

Then 然后

/your/current/repository $ git fetch origin
/your/current/repository $ git merge origin/master
/your/current/repository $ git push origin master

/client/path $ git fetch origin
/client/path $ git merge origin/master
/client/path $ git push origin master

That's just an example, the --bare repository can be anywhere. 只是一个例子,-- --bare信息库可以在任何地方。

Have a look here for pros and cons http://git-scm.com/book/ch4-1.html 在这里看看优缺点http://git-scm.com/book/ch4-1.html

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

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