git config --global user.name "bylion"
git config --global user.email bylion1990@gmail.com
mkdir Youtube-Git-Tutorial
cd Youtube-Git-Tutorial
git init
touch README
git add README git add .
git commit -m "first commit"
git remote add origin git@github.com:bylion/ROS.git no need to run everytime
git push origin master will be ask to input username and password
cd Youtube-Git-Tutorial
git
Problem
git push origin master
To git@github.com:bylion/ROS.git
! [rejected] master -> master (non-fast-forward)
error: failed to push some refs to 'git@github.com:bylion/ROS.git'
To prevent you from losing history, non-fast-forward updates were rejected
Merge the remote changes (e.g. 'git pull') before pushing again. See the
'Note about fast-forwards' section of 'git push --help' for details.
slove
git pull origin master
# Clones your fork of the repository into the current directory in terminal
git clone https://github.com/bylion/Github-Tutorial
more https://help.github.com/articles/fork-a-repo
ssh for linux
https://help.github.com/articles/generating-ssh-keys
Git has three main states that your files can reside in: committed, modified, and staged.
Committed means that the data is safely stored in your local database.
Modified means that you have changed the file but have not committed it to your database yet.
Staged means that you have marked a modified file in its current version to go into your next commit snapshot.
[Image] : http://git-scm.com/figures/18333fig0106-tn.png