Source Matters
Source Matters

Reputation: 1221

Git setup and pushing local repo to a virtualbox vm remote repo

New to version control completely, and trying my hand at using git for web development.

My setup is a Windows host with an Ubuntu guest (using Virtualbox). SSH works between them.

I'm simply trying to get my head around all the "basic" commands by trying to "convert" one of my existing website's root directory to a "git" repo, then attempting to mirror that repo to the remote repo which I want on the Ubuntu instance's /var/www/html folder.

It appears I have the "repo" part set up on both sides, but I keep failing at pushing the local directory and files to the VM.

I'm getting a little lost with all the tutorials and blogs. Some mention command line stuff, some recommend GUI applications... bit overwhelming. I'm using "Git for Windows" on host and standard git on guest.

I have this on Guest:

web@web-VirtualBox:/var/www/html/repos/zen.git$ sudo git init --bare
Initialized empty Git repository in /var/www/html/repos/zen.git/
web@web-VirtualBox:/var/www/html/repos/zen.git$ ls
branches  config  description  HEAD  hooks  info  objects  refs

How do I now push all the content on my local website's root directory to the guest using the git commands?

EDIT: wanting to learn the command line stuff first before using any GUI applications. Right now I have "GUI Bash" and "GUI Cmd" available on the Windows host.

Upvotes: 3

Views: 3681

Answers (1)

VonC
VonC

Reputation: 1324268

First, make sure to have a simplified PATH on your Windows host side.

Second, check that you can open an ssh session on your remote Linux server from your CMD shell, with the VirtualBox IP

ssh web@<VBox ip address>

That means you have created first an ssh public/private key (see "Creating SSH keys", I recommend one without passphrase), and copied the public key in ~web/.ssh/authorized_keys

Finally, the git clone URL would be web@web-VirtualBox:/var/www/html/repos/zen.git

But I don't recommend putting the .git directly in /var/www/html, as that folder is generally server by an http server. (Meaning the .git folder would be served as well)

Upvotes: 1

Related Questions