Skip to content
teradas edited this page Jul 17, 2013 · 8 revisions

Githubへのpushの仕方

Github利用時にproxyを越えることが一番の壁ですので成功例を以下にメモ

proxy越え

CentOS確認

mkdir ~/.ssh
ssh-keygen -t rsa -f github -C "(your_name)@(example.com)"  # githubに登録しているメールアドレス…かな
mv github ~/.ssh/
mv github.pub ~/.ssh/
gcc -o connect connect.c #このページ下部にファイルが添付してあります。Redmineはproxy関係無いので、CentOSでブラウザ立ち上げてダウンロードするのがラク。
sudo cp connect /usr/bin/
cd ~/.ssh/
vi config
chmod 600 *

~/.ssh/config

Host github.com
    User git
    HostName ssh.github.com
    Port 443
    ProxyCommand /usr/bin/connect -H (SingleID)@(プロキシサーバ):(ポート) %h %p
    IdentityFile ~/.ssh/github

testリポジトリにpushしてみる

  • 自分のリポジトリにtestリポジトリを作成
  • github.pubを登録
https://github.com/settings/profile にアクセス
SSH Keysメニューより、github.pubのテキストを追加
  • testリポジトリを作成して先ほど作成したtestリポジトリをリモート登録してpush
mkdir test
cd test
git init
git config --global user.name "(英字名前)"
git config --global user.email (email)
touch README
git add README
git commit -m 'first commit'
git remote add origin git@github.com:(自分のアカウント名)/test.git
git push -u origin master

既にgithubにあるtestリポジトリを取ってくる

git clone git@github.com:(自分のアカウント名)/test.git

testフォルダにリポジトリの複製が作成されます

参考

Clone this wiki locally