1ï¼é¦å
æ¾ä¸ä¸ªä»£ç æ管ç½åï¼ågitcafeï¼æ³¨åä¸ä¸ªç¨æ·åyournameã
2ï¼å¨gitcafeä¸æ°å»ºä¸ä¸ªç©ºç项ç®ï¼å好å称ï¼æ¯å¦Clangã
3ï¼å¨æ¬å°å®è£
好gitï¼linuxä¸çè¯å¾ç®åï¼åºæ¬ä¸é»è®¤å®è£
äºãwinä¸é¢æ¨èç¨cygwin模ælinuxç¯å¢ï¼ç´æ¥ä¸è½½å®è£
git软件å
ã
4ï¼è®¾ç½®å¥½æ¬å°çsshå¯é¥ï¼
$ cd ~/. ssh æ£æ¥æ¬æºçsshå¯é¥
å¦ææ示ï¼No such file or directory 说æä½ æ¯ç¬¬ä¸æ¬¡ä½¿ç¨gitã
å¦æä¸æ¯ç¬¬ä¸æ¬¡ä½¿ç¨ï¼è¯·æ§è¡ä¸é¢çæä½,æ¸
çåæsshå¯é¥ã
$ mkdir key_backup
$ cp id_rsa* key_backup
$ rm id_rsa*
çææ°çå¯é¥ï¼
ssh-keygen ât rsa âC â
[email protected]â
注æ: æ¤å¤çé®ç®±å°åï¼ä½ å¯ä»¥è¾å
¥èªå·±çé®ç®±å°åãå¨å车ä¸ä¼æç¤ºä½ è¾å
¥ä¸ä¸ªå¯ç ï¼è¿ä¸ªå¯ç ä¼å¨ä½ æ交项ç®æ¶ä½¿ç¨ï¼å¦æ为空çè¯æ交项ç®æ¶åä¸ç¨è¾å
¥ãè¿ä¸ªè®¾ç½®æ¯é²æ¢å«äººå¾ä½ ç项ç®éæ交å
容ã
æå¼æ¬å°ç.ssh/id_rsa.pubæ件ãæ¤æ件éé¢å
容为åæçæ人å¯é¥ã
ç»égitcafeç³»ç»ãç¹å»è´¦æ·è®¾ç½®--->SSHå
¬é¥ç®¡ç ---> æ·»å æ°çå
¬é¥ï¼æä½ æ¬å°çæçå¯é¥å¤å¶å°éé¢ï¼keyææ¬æ¡ä¸ï¼ï¼ ç¹å» ä¿å å°±okäº
第ä¸æ¬¡å¨æ¬å°è®¾ç½®gitæ¶é¡»ï¼
$ git config --global user.name "yourname"//gitcafeä¸çç¨æ·å
$ git config --global user.email "
[email protected]"//å¡«åèªå·±çé®ç®±
5ï¼éä¸ä¸ªæ¬å°ç项ç®åæ¾ä½ç½®ï¼æ¯å¦/homeæ件夹ã
6ï¼å¨homeä¸æ°å»ºä½ ç项ç®Clangæ件夹ï¼è¿å
¥Clangæ件夹ï¼æ°å»ºä¸ä¸ªreadmeæ件ï¼ç¶å使ç¨å¦ä¸å½ä»¤ï¼
$ git status //æ¥çå½å项ç®ä¸æææçç¶æï¼å¦æ第ä¸æ¬¡ï¼ä½ ä¼åç°é½çº¢é¢è²çï¼å 为å®è¿æ²¡æ交ç»git/gitcafe管çã
$ git add . //ï¼.ï¼ç¹è¡¨ç¤ºå½åç®å½ä¸çææå
容ï¼äº¤ç»git管çï¼ä¹å°±æ¯æ交å°äºgitçæ¬å°ä»åºã
Ps:gitç强大ä¹å¤å°±æ¯æä¸ä¸ªæ¬å°ä»åºçæ¦å¿µï¼å¨æ²¡æç½ç»çæ
åµä¸å¯ä»¥å
å°æ´æ°çå
容æ交å°æ¬å°ä»åºã
$ git commit âm "new natter " //å¯¹ä½ æ´æ°æä¿®æ¹äºåªäºå
容åä¸ä¸ªæè¿°ã
$ git remote add origin
[email protected]:yourname/Clang.git
//å¦æä½ æ¯ç¬¬ä¸æ¬¡æ交项ç®ï¼è¿ä¸å¥é常éè¦ï¼è¿æ¯ä½ æ¬å°çå½åç项ç®ä¸è¿ç¨çåªä¸ªä»åºå»ºç«è¿æ¥ã
Ps: originå¯ä»¥æ¹ä¸ºå«äººçååï¼ä½æ¯å¨ä½ ä¸ä¸æ¬¡pushï¼æ交ï¼æ¶ï¼ä¹è¦ç¨ä½ ä¿®æ¹ä¹åçååã
$ git remote -v //æ¥çä½ å½å项ç®è¿ç¨è¿æ¥çæ¯åªä¸ªä»åºå°åã
$ git push -u origin master //å°æ¬å°ç项ç®æ交å°è¿ç¨ä»åºä¸ã
7ï¼ä»¥ä¸æ¥éª¤å°±æ¯ä½ å°æ°å»ºçClang项ç®æ¨éå°gitcafeæ管çæ¥éª¤ãå½ä½ å¨å«ç主æºä¸æ³è¦ä¸è½½è¿ä¸ªé¡¹ç®æ¶ï¼é¦å
è¿æ¯å
设置好sshå
¬é¥å¹¶å¨ç½ç«ä¸æ·»å ï¼ç¶åï¼
$git clone
[email protected]:yourname/Clang
//项ç®ç¼ä¼å
éå°ä½ çå½å主æºä¸
8ï¼å¦ææ³å é¤é¡¹ç®ä¸çä¸ä¸ªæ件ï¼æ¯å¦Clangæ件夹ä¸ça.c ï¼
$cd Clang/
$git rm a.c
$gir commit -m "delete a.c"
$git push origin master
9ï¼å¦æä½ æ³ä½¿æ¬å°çClang项ç®ä¸ç½ç«ä¸ææ°ç项ç®åæ¥ï¼
$ cd Clang/
$ git fetch origin //åå¾è¿ç¨æ´æ°ï¼è¿éå¯ä»¥çåæ¯åå¤è¦åäº
$ git merge origin/master //ææ´æ°çå
容å并å°æ¬å°åæ¯/master
10ï¼ä»¥ä¸å°±æ¯git代ç æ管çæç¨