Saturday, December 15, 2012

Setup remote Git repository

suppose the remote server is username@foo.com
suppose the repository is xxx.git

1. set up remote git repository
$mkdir ~/git-rep
$cd ~/git-rep
$mkdir xxx.git
$cd xxx.git
$git init --bare


2. on your local machine, add a remote repository aliases
$git remote add [ALIASES_NAME] username@foo.com
# check
$git remote -v


3. push your copy to the remote repository
# check branch
$git branch
$git push [ALIASES_NAME] master


4. Undo git add before the first commit
$git rm -r --cached .

5. repo inside a repo
$git submodule add [URL]
$git submodule init
$git submodule update

Note:
if you got an error: "bash: git-receive-pack: command not found", try
$git push [ALIASES_NAME] master --receive-pack=[REMOTE_PATH]/git-receive-pack

to avoid it, dump enviroment in .ssh/environment
env > .ssh/environment

Please note that setting up PATH in either .bashrc and .bash_profile does NOT work!

Sunday, December 9, 2012

Remotely Shutdown Virtualbox VM

1. List the running vms: 
    VBoxManage list runningvms

2. Close the running vm
    vboxmanage controlvm "VM name" savestate
    savestate can also be resume, reset, or poweroff

Saturday, December 8, 2012

How to access Box.com files from Ubuntu 12.10?


1. sudo apt-get install davfs2

2. sudo dpkg-reconfigure davfs2

    In the screen select Yes

3. sudo cp -r /etc/davfs2/ ~/.davfs2

4. sudo chown -R [ubuntu username] ~/.davfs2/

5. edit ~/.davfs2/secrets. add this line at the end of the file:
    https://www.box.com/dav [box.com username] [box.com password]

6. edit ~/.davfs2/davfs2.conf. uncomment:
    use_locks 0

7. sudo adduser [ubuntu username] davfs2

8. mkdir ~/box.com

9. edit /etc/fstab. add this line at the end of the file:
     https://www.box.com/dav/ /home/[ubuntu username]/box.com davfs _netdev,rw,user 0 0

10. reload fstab
      mount -a