I have my Git repo on my machine, which has no public IP of its own, at home; I want to clone this repo at my web server. Is it correct that a reverse tunnel will allow me to pull from my machine to the server? What command(s) do I issue to perform the clone? My local machine runs Windows; the server runs Ubuntu.
相关问题
- JavaScript File Transfer SSH
- Why does recursive submodule update from github fa
- Extended message for commit via Visual Studio Code
- Emacs shell: save commit message
- Can I organize Git submodules in a flat hierarchy?
相关文章
- 请教Git如何克隆本地库?
- Check if directory exists on remote machine with s
- GitHub:Enterprise post-receive hook
- Git Clone Fails: Server Certificate Verification F
- SSIS solution on GIT?
- Is there a version control system abstraction for
- ssh: Could not resolve hostname git: Name or servi
- Cannot commit changes with gitextensions
In principle, you can do something like
and then use on your webserver
This will encrypt your data twice, though.
Alternatively, you can use any of the other protocols which git supports, and forward the right ports for these.
You can also put a section like this into ~/.ssh/config:
Then you can use this clone command:
git clone git@my-server:mytools/projectName.git
. (This allows you to store the server's key not as belonging tolocalhost
, and makes the URL in your git config clearer.)For your server (both the tunnel server and the final host) you usually want to authenticate per public-key authorization, for this you should put the private key (e.g. id_rsa) in your ~/.ssh directory. (And all files there, specifically the private key, should be readable only for your user, and the directory writable only for your user.)
All this is not specific for the tunnel, but generic SSH stuff.
I haven't tried this myself (and can't speak for how well it deals with NAT), but it sounds like DynDNS could be one solution to your problem. It provides a public URL to your home machine that can even update itself automatically. From their support page:
Of course, because this will make it easier for other people to access your computer, as well, you should also take appropriate security measures. If it works, though, you could just ssh into your home machine through the DynDNS URL.
You could push the changes to the web server, instead of trying to pull them:
Set up a repos on the web server:
Push to that repos from your dev machine:
If you want to push to a non-bare repos (e.g. if your web app runs in a checkout), then you will need to push to a branch which is not currently checked out and then merge in.
i.e. on your dev machine:
then log into the web machine and do:
Another alternative is to set up a bare repository on your server, and push to it from your local machine. Pull from there into your server's repository.
There are many advantages:
See http://joemaller.com/990/a-web-focused-git-workflow/ for a good description.
You can open the ssh port on your firewall and set routing on your router to hit your machine. You'll only need the ip that your router exposes.