简体   繁体   English

如何从存储在计算机上的存储库中进行“ git pull”

[英]How to do a 'git pull' from repository stored on a computer

I was wondering if anyone can help me with this. 我想知道是否有人可以帮助我。 I have set up a local GIT server using GOGS, in which I can successfully commit my work and clone on that very same machine. 我已经使用GOGS设置了本地GIT服务器,在其中可以成功提交工作并在同一台计算机上进行克隆。 I use GIT Bash to do all my commits,pulls, pushes etc. 我使用GIT Bash进行所有提交,拉动,推送等操作。

The trouble (or lack of knowledge) I am having is how can one clone that project from another machine? 我遇到的麻烦(或知识不足)是如何从另一个计算机克隆该项目? For example, I have my computer on at home which has my local GIT server running. 例如,我在家中有运行本地GIT服务器的计算机。 I want to clone my repository at my work place, and then commit my project once I have done my work on it. 我想在工作场所克隆存储库,然后在完成工作后提交项目。 Both the SSH and HTTP links provided in GOGS state "access denied" whenever I try to do a clone on another computer. 每当我尝试在另一台计算机上进行克隆时,GOGS中提供的SSH和HTTP链接都将“访问被拒绝”。

Any instructions or help would be greatly appreciated. 任何指示或帮助将不胜感激。

You don't need a "git server". 您不需要“ git服务器”。 Git is really just files, either accessible via HTTP(s), SSH, the GIT protocol, or, and that's a really usual case, locally as files. Git实际上只是文件,可以通过HTTP(s),SSH,GIT协议进行访问,或者,在通常情况下,可以作为文件本地访问。

You can do something like 你可以做类似的事情

In your "remote" directory: 在您的“远程”目录中:

mkdir myrepo
git init --bare myrepo

In your "work" repository: 在您的“工作”存储库中:

git remote add origin /path/to/remote/directory/myrepo
git push --all origin

Done! 做完了!

If you really need something like GOGS to manage access to the repo from other computers, just make sure that the SSH server listens on your local ip address. 如果您确实需要诸如GOGS之类的东西来管理从其他计算机对存储库的访问,则只需确保SSH服务器侦听您的本地IP地址即可。

The fact that you can't access your repo from the other computers really just means that you're not using the right credentials. 您无法从其他计算机访问您的存储库的事实实际上仅表示您没有使用正确的凭据。 I don't know your GOGS configuration, but probably you haven't added the public key you use at work to the public keys of the GOGS user owning your directory and/or aren't using the right SSH user (typically "git") to log in to your server. 我不知道您的GOGS配置,但可能您尚未将在工作中使用的公钥添加到拥有目录的GOGS用户的公钥和/或未使用正确的SSH用户(通常为“ git” )登录到您的服务器。 I'm 100% confident you'll find a documentation on how to use your GOGS installation if you just look. 我有100%的信心,只要您看一下,便会找到有关如何使用GOGS安装的文档。

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

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