git Bash共通コマンド

1822 ワード

1.Construct ssh key (If you want to commit to git server via THIS COMPUTER)

git config --global user.name " YOUR_USERNAME"
git config --global user.email "[email protected]"
cd ~/.ssh
ssh-keygen -t rsa -C "[email protected]"
【 then enter your passphrase

  after these operation , copy the content of "~/.ssh/id_rsa.pub"to the git server
 

2.Setup a new repository on your server


  Manually or via GUI      【 cz I don't know how to setup via bash :<
 

3.Commit your code to server


  If it's the first time you commit your code :
cd /your/source/code/folder
git init
git add .
git commit -m "first commit"
git remote add origin [email protected]:username/project.git 
git push -u origin master

  Or if you have once commited :
git add .
git commit -m "second commit"
git push -u origin master

 

4.Clone your code from server to PC

cd /your/destination/directory
git clone [email protected]:username/repository.git

 
 
Ref:
http://blog.csdn.net/it_yuan/article/details/8638321
http://www.cnblogs.com/wenjiang/p/3161682.html
http://stackoverflow.com/questions/10285198/git-clone-fatal-remote-error-access-denied-or-repository-not-exported