Moving github repo to Bitbucket due to DDOS

Github Under JS-Based “Greatfire” DDoS Attack, Allegedly From Chinese Government.

**Because of this DDOS attack, it affects our depolyment process. So we planned to move some of the critical repos to **__bitbucket (for temp).

STEP1:-

Create your private repo in the bitbucket.

STEP2:-

Let’s suppose in your local machine you already have a clone repo of your code from github.com

From your local machine, you need to change the origin, you need to push all tags, branches and refs to the bitbucket.

So you need to do the below commands

_ _

[color-box color="green”]

git remote -v     #It will show the origin (fetch and push) like below:

origin [email protected]:username/yourproject.git (fetch)

origin [email protected]:username/yourproject.git (push)

[/color-box]

Now your origin is github.com. Before changing it to bitbucket, you need to do checkout all your remote branches to your local machine, then only you can push your branches to bitbucket, otherwise you can only push the tags, there won’t be any branches apart from “master”.

[color-box color="green”]

git branch     #will list the branch in your local machine

git branch -r     #will list the remote branch from github

[/color-box]

_ Now, you can use the below commands to checkout all your remote branches to your localmachine._

[color-box color="green”]

for remote in git branch -r ; do git branch –track $remote; done

for remote in git branch -r ; do git checkout $remote ; git pull; done

[/color-box]

_ Then again checkout to master_

[color-box color="green”]

git status

git checkout master

[/color-box]

Now, we need to move the origin from github to bitbucket

[color-box color="green”]

git remote -v

git remote rm origin

git remote -v

git remote add origin [email protected]:username/your-repo-in-bitbucket.git

git push -u origin –all

git push -u origin –tags

[/color-box]

This will move all from github to bitbucket.

We use Capistrano for deployment, so update your deploy.rb file.

Change the git repo to bitbucket repo.

[color-box color="green”]

set :repository, “[email protected]:username/githubrepo.git”

[/color-box]

 Change the above line and update it with your bitbucket repo.

[color-box color="green”]

set :repository, “[email protected]:username/your-repo-in-bitbucket.git”

[/color-box]

**Now you are good to deploy. **