简体   繁体   中英

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. I use GIT Bash to do all my commits,pulls, pushes etc.

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. 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.

Any instructions or help would be greatly appreciated.

You don't need a "git server". 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.

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.

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. I'm 100% confident you'll find a documentation on how to use your GOGS installation if you just look.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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