Difference between revisions of "Migration from Bitbucket to a local git repository"

From wiki.ferrari.mo.it
Jump to navigation Jump to search
(Created page with "= Migrate form a remote (e.g. Bitbucket) to a local git server = == Server side ==")
 
 
(3 intermediate revisions by the same user not shown)
Line 2: Line 2:
  
 
== Server side ==
 
== Server side ==
 +
 +
Install needed packets
 +
 +
apt-get install git
 +
apt-get install git-server
 +
 +
Create user git (and certificate)
 +
 +
adduser git
 +
mkdir /usr/local/git/
 +
chown git:git /usr/local/git
 +
 +
Certificate
 +
 +
cd /home/git/
 +
openssl req -x509 -nodes -days 3650 -newkey rsa:2048 -keyout ./git.key -out ./git.crt
 +
cat git.key > /home/git/.ssh/authorized_keys
 +
 +
Then, edit authorized_keys this way:
 +
 +
no-port-forwarding,no-X11-forwarding,no-agent-forwarding,no-pty ssh-rsa
 +
KEY gsg-keypair
 +
 +
Note: KEY is the generated key, without the header and the footer.
 +
 +
Init repositories:
 +
 +
git init --bare eywa-3.git
 +
 +
== Client side ==
 +
 +
1) Download the .zip file from the repository/branch you want to migrate;
 +
 +
2) Unzip the file in a directory of your choice (e.g. Users/<USER>/Workspaces/eywa-3);
 +
 +
3) Edit//remove the files you need;
 +
 +
From a normal "cmd":
 +
 +
4) Initialize:
 +
 +
git init
 +
 +
5) Add origin:
 +
 +
git remote add origin git@167.172.41.3:/usr/local/git/eywa-3.git
 +
 +
6) Set origin:
 +
 +
git remote set-url origin git@167.172.41.3:/usr/local/git/eywa-3.git
 +
 +
7) Commit and push:
 +
 +
git add *
 +
git commit -m "Initial commit"
 +
git push origin master
 +
 +
8) Test:
 +
 +
git ls-tree -r master --name-only

Latest revision as of 18:28, 18 March 2026

Migrate form a remote (e.g. Bitbucket) to a local git server[edit]

Server side[edit]

Install needed packets

apt-get install git
apt-get install git-server

Create user git (and certificate)

adduser git
mkdir /usr/local/git/
chown git:git /usr/local/git

Certificate

cd /home/git/
openssl req -x509 -nodes -days 3650 -newkey rsa:2048 -keyout ./git.key -out ./git.crt
cat git.key > /home/git/.ssh/authorized_keys

Then, edit authorized_keys this way:

no-port-forwarding,no-X11-forwarding,no-agent-forwarding,no-pty ssh-rsa
KEY gsg-keypair

Note: KEY is the generated key, without the header and the footer.

Init repositories:

git init --bare eywa-3.git

Client side[edit]

1) Download the .zip file from the repository/branch you want to migrate;

2) Unzip the file in a directory of your choice (e.g. Users/<USER>/Workspaces/eywa-3);

3) Edit//remove the files you need;

From a normal "cmd":

4) Initialize:

git init

5) Add origin:

git remote add origin git@167.172.41.3:/usr/local/git/eywa-3.git

6) Set origin:

git remote set-url origin git@167.172.41.3:/usr/local/git/eywa-3.git

7) Commit and push:

git add *
git commit -m "Initial commit"
git push origin master

8) Test:

git ls-tree -r master --name-only