0.環境

  [CentOS]   5.6 (32bit版カーネル)
  [Git]      1.9.4

1.ダウンロード

  • (1-1) Githubのソース取得

    • githubリポジトリ

    • 任意のディレクトリでGitHubのリポジトリから対象ソースを取得します。

    • (上図の画面右下がURL)

      # git clone git@github.com:Sankame/repo-of-github.git
      
    • 取得したソースの第1階層へ移動。

      # cd repo-of-github/
      
  • (1-2) Bitbucketへソースアップ

    • 予めBitbucket上で任意のリポジトリを作っておきます。

    • bitbucketリポジトリ作成

    • 空のリポジトリができました。

    • bitbucket新規リポジトリ

    • 上記(1-1)で GitHub から取得したソースは origin がGitHubになっているので、 Bitbucket へ変更します。

      # git remote -v
      origin  git@github.com:Sankame/repo-of-github.git (fetch) 
      origin  git@github.com:Sankame/repo-of-github.git (push)
      
      # git remote rm origin
      # git remote add origin git@bitbucket.org:Sankame/repo-of-bitbucket.git
      # git push -u origin --all # pushes up the repo and its refs for the first time
      # git push -u origin --tags # pushes up any tags
      
    • GitHubにあったソースをBitbucketへプッシュできました。

    • bitbucket取り込んだソース

    • もし上記 “git remote add origin” でプロトコルにhttpsを指定していて、”git push” で下記エラーが出た場合は「2.git pushが動かない場合」を参照して下さい。

    • fatal: Unable to find remote helper for 'https'

2.git pushが動かない場合

  • (2-1) Gitをhttpsへ対応させる

    • このページによるとcurl-develがないのが原因と書いてありましたが、僕の環境には既に入っていたので、gitを再コンパイル&インストールしたところうまくいきました。

    • (gitのソースが手元にある場合は再取得しなくてもOKです)

    • (rootで操作しているのでインストール時にprefixを指定しました)

      # wget https://www.kernel.org/pub/software/scm/git/git-1.9.4.tar.gz
      # tar xzf git-1.9.4.tar.gz
      # cd git-1.9.4
      # ./configure
      # make clean
      # make
      # make prefix=/usr install