-
安装vagrant和virtualBox
-
建立并进入开发环境目录
-
下载box选择低点的版本--Ubuntu lucid 32
-
添加box
vagrant box add base
+ 远端的box地址或者本地的box文件名,先下载到本地再添加速度会比较快 -
vagrant init
-
vagrant up # 启动环境,改写vagrantfile里面的config. vm.network :forwarded_port, guest: 3000, host: 3000以及vagrant的ID信息
-
打开SecureCRTPortable # 新建Sessions 主机名为127.0.0.1,填写端口2222,账户密码等相关信息
-
sudo apt-get update
-
Install Git with Apt-Get command:sudo apt-get install git-core
-
使用cmd 到D:develoment/Freetalks/ 运行 vagrant reload(
重启
)
-
vagrant up
开机 -
vagrant halt
关机 -
vagrant reload
重启
-
cd/挂载目录(在命令窗口中先去到Vagrant init 装载目录下才启动)
-
cd /vagrant 返回到计算机安装目录下
-
git config --global user.name "Your Name"
(安装完git后,设置用户名与邮箱) -
git config --global user.email "Your email"
(设置邮箱) -
ssh-keygen -t rsa -C "[email protected]"
(创建 SSH key) -
ssh-agent -s
(查看 ssh 是否启用) -
ssh -T [email protected]
(验证) -
git init
(初始化一个本地仓库) -
git add .
(将所有文件加入到跟踪列表) -
git commit -m "write something title"
(提交到本地仓库) -
git status
(查看git文件哪处发生改动) -
git remote add origin [email protected]:github账户名/github创建的库.git
(将本地仓库关联到github上远程仓库) -
git push -u origin master
(将本地仓库的所有内容推送到远程库上,下一次推送时直接git push
) -
git clone URL
(克隆远程仓库) -
git branch
(查看当前分支) -
git checkout -- filename
(文件恢复到最新版本,但丢失最近一次提交后你修改的内容) -
git checkout name
(切换分支,name 为分支名称)
-
vim filename
(打开编辑文件) -
按一下
i
键 (进行编辑文件) -
按一下
Esc
键 (退出i(插入)命令进行其它命令使用) -
:wq
(保存文件并退出) -
:q!
(强制退出,不保存) -
: w filename
(将文章以指定的文件名filename保存)
-
在vistualbox ubuntu 界面的左上角的设置——》共享文件夹——》选择一个在本机上的文件夹位置——》设置一个文件名称
-
进入Ubuntu终端 在命令行中输入
sudo mkdir /mnt/share (在mnt目录下创建一个share文件夹)
sudo mount -t vboxsf name(创建共享文件夹的名称) /mnt/share
-
使用cp命令实现文件的复制,把在其他文件夹下的目录复制到 /mnt/share,即实现文件共享在win7本机上也会看到该文件 cp -r 复制文件名 /mnt/share(共享文件夹位置)