たなしょのメモ

日々勉強していることをつらつらと

Vargrantのubuntu仮想環境でgit導入

gitの公式サイトに行けば書いてあるが、

 

git-scm.com

 

下記コマンドインストール可能。仮想環境なのでsudoが必須。

apt-get install libcurl4-gnutls-dev libexpat1-dev gettext \ libz-dev libssl-dev

git --versionコマンドでバージョンを確認できればOK。

vagrant@vagrant-ubuntu-trusty-64:~$ git --version
git version 1.9.1
vagrant@vagrant-ubuntu-trusty-64:~$

 試しにgithubリポジトリにpushする前にgithubのユーザとメールアドレスを登録、

 

vagrant@vagrant-ubuntu-trusty-64:~/c++_pra$ git config --global user.email "5511068t@gmail.com"
vagrant@vagrant-ubuntu-trusty-64:~/c++_pra$ git config --global user.name "jacoloves" 

 pushする際は、

vagrant@vagrant-ubuntu-trusty-64:~/c++_pra$ git init
Reinitialized existing Git repository in /home/vagrant/c++_pra/.git/
vagrant@vagrant-ubuntu-trusty-64:~/c++_pra$ git add ./

vagrant@vagrant-ubuntu-trusty-64:~/c++_pra$ git commit -m "AtCoder用のリボジトリ"
[master (root-commit) 4b11cbb] AtCoder用のリボジトリ
1 file changed, 7 insertions(+)
create mode 100644 samplecppSource.cpp
vagrant@vagrant-ubuntu-trusty-64:~/c++_pra$ git remote add origin https://github.com/jacoloves/C-_practice.git

vagrant@vagrant-ubuntu-trusty-64:~/c++_pra$ git push -u origin master

 これで今後C++用のリポジトリとして使える。