GitHubã®èªåã®ãªãã¸ããªã«pushããã¨ãã«ãSSHãã¼ã使ã£ã¦ã§ããã®ã ããã¡ãã£ã¨ããã£ãã®ã§ãåå¿é²ãã¦ããã
ããã£ããã¤ã³ãã¯ã
1. ~/.ssh/id_rsa ã¯ãä»ã®ç°å¢ã«ä½¿ã£ã¦ã
2. å
ã«GitHubã§ãªãã¸ããªä½ã£ã¦ãããcloneããç¶æ
ã ã£ã
ã£ã¦æãããªã¼ã
1ã¯ãid_rsaãGitHubç¨ã«ä½¿ããå ´åãã¨ãã«åé¡ã«ãªããªããã©ãç§ã®å ´åã¯ãè²ããªSSHç°å¢ã«æ¥ç¶ããæåãid_rsa_xxxã¿ããã«ãã¡ã¤ã«åã§ç°å¢ã管çãã¦ãã
ã®ã§ãããã£ãã
2ã¯ãGitHubããcloneãã¦ããã¨ãã«ã
ããããURLãclipãã¦
$ git clone https://github.com/...
ã£ã¦ãã£ã¦ãã¾ã£ãããã§ããããSSHæ¥ç¶ã«ãªããªãã®ã§ã1ãã¯ãªã¢ãã¦ãçµå±ãpushã§ããªãã¿ãããªãããæ¹ãããã
ã§ããã¡ãã¨ãæ´çãã¦ã以ä¸ã®æé ãå®æ½ããã°ããããã¨æãã
1. SSHãã¼ãä½æ
2. GitHubã«SSHãã¼ãç»é²
3. ~/.ssh/configã«è¿½å
4. git remote originã®è¨å®å¤æ´
5. git push
GitHubå®è·µå ¥é ~Pull Requestã«ããéçºã®å¤é© (WEB+DB PRESS plus)
- ä½è : 大å¡å¼è¨
- åºç社/ã¡ã¼ã«ã¼: æè¡è©è«ç¤¾
- çºå£²æ¥: 2014/03/20
- ã¡ãã£ã¢: åè¡æ¬ï¼ã½ããã«ãã¼ï¼
- ãã®ååãå«ãããã° (11件) ãè¦ã
1. SSHãã¼ãä½æ
以ä¸ã®ã³ãã³ããå®è¡ãã¦ä½æããã
$ cd ~/.ssh $ ssh-keygen Generating public/private rsa key pair. Enter file in which to save the key (/Users/xxx/.ssh/id_rsa): id_rsa_github Enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in id_rsa_github. Your public key has been saved in id_rsa_github.pub. ...
åé ã«è¿°ã¹ãã¨ããã ~/.ssh/id_rsaã«åºåããããªãã®ã§ã~/.sshãã£ã¬ã¯ããªã«ç§»åãã¦ãããid_rsa_githubã£ã¦ååãæå®ãã¦ãã
ããã§~/.sshãã£ã¬ã¯ããªç´ä¸ã«ã
ã®ãã¡ã¤ã«ãã§ãã¦ããã¯ãã
2. GitHubã«SSHãã¼ãç»é²
次ã«ãid_rsa_github.pubã®ä¸èº«ãGitHubã«ç»é²ããã®ã ãããã
ãã®ãããã¯ãGitHubãªããä»ãµã¤ããªããåç §ããã ããããçç¥ããã¦ããã ãã¾ãã
â»ä¸å¿ãå
¬å¼ã®ãªã³ã¯ãè²¼ã£ã¨ãã¾ã
Generating SSH Keys · GitHub Help
3. ~/.ssh/configã«è¿½å
Vimãªãã§ã以ä¸ã®ãã¡ã¤ã«ãéãã¦è¿½è¨ããã
$ vim ~/.ssh/config
Host github.com HostName github.com User git IdentityFile "/Users/xxx/.ssh/id_rsa_github"
ããã§ããããã¤ã³ã1ã®ç»å ´ã
Host github.com
ã®ã¨ããã¯ã4ã®æé ã§å®æ½ããã git://github.com/... ã®github.comã¨ããããªãã¨èªèãããªããã注æã
ã¤ã¾ãã
Host github.com.hogehoge
ã¨ããã¦ã git://github.com.hogehoge/... ã£ã¦ãã¦ãè¯ãã
hogehogeã®ã¨ãããç®çã«å¿ãã¦å¤æ´ããã¨ãã§ã管çã§ãããããã ããã
4. git remote originã®è¨å®å¤æ´
ããããã¤ã³ã2ã®ç»å ´ã
HTTPSã§cloneãã¦ãã®ã§ã以ä¸ã®ã³ãã³ããå®è¡ãã¦ãSSHã§remoteæ¥ç¶ããããã«å¤æ´ããã
$ git remote -v origin https://github.com/USERNAME/REPOSITORY.git (fetch) origin https://github.com/USERNAME/REPOSITORY.git (push)
ã§ãremoteãHTTPSã«ãªã£ã¦ããã¨ã確èªãã¦ã
$ git remote set-url origin [email protected]:USERNAME/REPOSITORY.git
ã£ã¦å®è¡ãã¦ããã¨ãOKã
5. git push
git push origin master
ã£ã¦å®è¡ããã¨ãã¾ããã¨ãããã¯ã!!
以ä¸ã