yuki-kimoto / gitprep

Portable GitHub system into your own server
http://gitprep.yukikimoto.com/
906 stars 118 forks source link

how to import existing repos #198

Open flynn1973 opened 1 year ago

flynn1973 commented 1 year ago

maybe i am missing something, but i am asking anyway..

i am running gitprep as cgi in apache httpd...i can login in the interface and create users, been there, done that. but i have no idea how to create repos or how to import my existing.

when running import_rep it fails...

root@lpgaixmgmtlx01:/var/www/gitprep/gitprep/script>./import_rep -u aix /git **<--location of my existing repos**
Can't creat repository ansible: DBD::SQLite::st execute failed: NOT NULL constraint failed: project.default_branch. Following SQL is executed.
insert into "project" ("user", "default_branch", "id") values (? , ? , ? )
(DBIx::Custom::execute) at (eval 103) line 1.
 at ./import_rep line 64.

Can't update description ansible
fatal: '/var/www/gitprep/gitprep/script/../data/rep/aix/ansible.git' does not appear to be a git repository
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
Can't push branches: git push /var/www/gitprep/gitprep/script/../data/rep/aix/ansible.git --all at ./import_rep line 102.
fatal: '/var/www/gitprep/gitprep/script/../data/rep/aix/ansible.git' does not appear to be a git repository
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
Can't push tags: git push /var/www/gitprep/gitprep/script/../data/rep/aix/ansible.git --tags at ./import_rep line 109.
Can't creat repository test: DBD::SQLite::st execute failed: NOT NULL constraint failed: project.default_branch. Following SQL is executed.
insert into "project" ("user", "default_branch", "id") values (? , ? , ? )
(DBIx::Custom::execute) at (eval 103) line 1.
 at ./import_rep line 64.

Can't update description test
fatal: '/var/www/gitprep/gitprep/script/../data/rep/aix/test.git' does not appear to be a git repository
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
Can't push branches: git push /var/www/gitprep/gitprep/script/../data/rep/aix/test.git --all at ./import_rep line 102.
fatal: '/var/www/gitprep/gitprep/script/../data/rep/aix/test.git' does not appear to be a git repository
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
Can't push tags: git push /var/www/gitprep/gitprep/script/../data/rep/aix/test.git --tags at ./import_rep line 109.
Can't creat repository ulb: DBD::SQLite::st execute failed: NOT NULL constraint failed: project.default_branch. Following SQL is executed.
insert into "project" ("default_branch", "id", "user") values (? , ? , ? )
(DBIx::Custom::execute) at (eval 103) line 1.
 at ./import_rep line 64.

Can't update description ulb
fatal: '/var/www/gitprep/gitprep/script/../data/rep/aix/ulb.git' does not appear to be a git repository
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
Can't push branches: git push /var/www/gitprep/gitprep/script/../data/rep/aix/ulb.git --all at ./import_rep line 102.
fatal: '/var/www/gitprep/gitprep/script/../data/rep/aix/ulb.git' does not appear to be a git repository
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
Can't push tags: git push /var/www/gitprep/gitprep/script/../data/rep/aix/ulb.git --tags at ./import_rep line 109.
Can't creat repository wikijs: DBD::SQLite::st execute failed: NOT NULL constraint failed: project.default_branch. Following SQL is executed.
insert into "project" ("user", "id", "default_branch") values (? , ? , ? )
(DBIx::Custom::execute) at (eval 103) line 1.
 at ./import_rep line 64.

Can't update description wikijs
fatal: '/var/www/gitprep/gitprep/script/../data/rep/aix/wikijs.git' does not appear to be a git repository
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
Can't push branches: git push /var/www/gitprep/gitprep/script/../data/rep/aix/wikijs.git --all at ./import_rep line 102.
fatal: '/var/www/gitprep/gitprep/script/../data/rep/aix/wikijs.git' does not appear to be a git repository
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
Can't push tags: git push /var/www/gitprep/gitprep/script/../data/rep/aix/wikijs.git --tags at ./import_rep line 109.

so how to do the import...or how to create new repos?

yuki-kimoto commented 1 year ago

It looks like an error that project.default_branch is null.

NOT NULL constraint failed: project.default_branch

Could you debug Perl script import_rep?

flynn1973 commented 1 year ago
root@lpgaixmgmtlx01:/var/www/gitprep/gitprep/script>perl -d ./import_rep -u aix /git

Loading DB routines from perl5db.pl version 1.51
Editor support available.

Enter h or 'h h' for help, or 'man perldebug' for more help.

IO::Socket::SSL::CODE(0x10018230920)(/usr/share/perl5/vendor_perl/IO/Socket/SSL.pm:242):
242:            INIT { init() }
  DB<1> c
Can't creat repository ansible: DBD::SQLite::st execute failed: NOT NULL constraint failed: project.default_branch. Following SQL is executed.
insert into "project" ("default_branch", "user", "id") values (? , ? , ? )
(DBIx::Custom::execute) at (eval 104)[/var/www/gitprep/gitprep/script/../extlib/lib/perl5/DBIx/Custom/Model.pm:40] line 1.
 at ./import_rep line 64.

 at ./import_rep line 67.
Can't update description ansible
 at ./import_rep line 89.
fatal: '/var/www/gitprep/gitprep/script/../data/rep/aix/ansible.git' does not appear to be a git repository
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
Can't push branches: git push /var/www/gitprep/gitprep/script/../data/rep/aix/ansible.git --all at ./import_rep line 102.
 at ./import_rep line 102.
fatal: '/var/www/gitprep/gitprep/script/../data/rep/aix/ansible.git' does not appear to be a git repository
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
Can't push tags: git push /var/www/gitprep/gitprep/script/../data/rep/aix/ansible.git --tags at ./import_rep line 109.
 at ./import_rep line 109.
Can't creat repository test: DBD::SQLite::st execute failed: NOT NULL constraint failed: project.default_branch. Following SQL is executed.
insert into "project" ("default_branch", "user", "id") values (? , ? , ? )
(DBIx::Custom::execute) at (eval 104)[/var/www/gitprep/gitprep/script/../extlib/lib/perl5/DBIx/Custom/Model.pm:40] line 1.
 at ./import_rep line 64.

 at ./import_rep line 67.
Can't update description test
 at ./import_rep line 89.
fatal: '/var/www/gitprep/gitprep/script/../data/rep/aix/test.git' does not appear to be a git repository
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
Can't push branches: git push /var/www/gitprep/gitprep/script/../data/rep/aix/test.git --all at ./import_rep line 102.
 at ./import_rep line 102.
fatal: '/var/www/gitprep/gitprep/script/../data/rep/aix/test.git' does not appear to be a git repository
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
Can't push tags: git push /var/www/gitprep/gitprep/script/../data/rep/aix/test.git --tags at ./import_rep line 109.
 at ./import_rep line 109.
Can't creat repository ulb: DBD::SQLite::st execute failed: NOT NULL constraint failed: project.default_branch. Following SQL is executed.
insert into "project" ("default_branch", "id", "user") values (? , ? , ? )
(DBIx::Custom::execute) at (eval 104)[/var/www/gitprep/gitprep/script/../extlib/lib/perl5/DBIx/Custom/Model.pm:40] line 1.
 at ./import_rep line 64.

 at ./import_rep line 67.
Can't update description ulb
 at ./import_rep line 89.
fatal: '/var/www/gitprep/gitprep/script/../data/rep/aix/ulb.git' does not appear to be a git repository
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
Can't push branches: git push /var/www/gitprep/gitprep/script/../data/rep/aix/ulb.git --all at ./import_rep line 102.
 at ./import_rep line 102.
fatal: '/var/www/gitprep/gitprep/script/../data/rep/aix/ulb.git' does not appear to be a git repository
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
Can't push tags: git push /var/www/gitprep/gitprep/script/../data/rep/aix/ulb.git --tags at ./import_rep line 109.
 at ./import_rep line 109.
Can't creat repository wikijs: DBD::SQLite::st execute failed: NOT NULL constraint failed: project.default_branch. Following SQL is executed.
insert into "project" ("id", "user", "default_branch") values (? , ? , ? )
(DBIx::Custom::execute) at (eval 104)[/var/www/gitprep/gitprep/script/../extlib/lib/perl5/DBIx/Custom/Model.pm:40] line 1.
 at ./import_rep line 64.

 at ./import_rep line 67.
Can't update description wikijs
 at ./import_rep line 89.
fatal: '/var/www/gitprep/gitprep/script/../data/rep/aix/wikijs.git' does not appear to be a git repository
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
Can't push branches: git push /var/www/gitprep/gitprep/script/../data/rep/aix/wikijs.git --all at ./import_rep line 102.
 at ./import_rep line 102.
fatal: '/var/www/gitprep/gitprep/script/../data/rep/aix/wikijs.git' does not appear to be a git repository
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
Can't push tags: git push /var/www/gitprep/gitprep/script/../data/rep/aix/wikijs.git --tags at ./import_rep line 109.
 at ./import_rep line 109.
Debugged program terminated.  Use q to quit or R to restart,
use o inhibit_exit to avoid stopping after program termination,
h q, h R or h o to get additional info.
  DB<1> q
yuki-kimoto commented 1 year ago

Please tell me the name of the default branch of ansible.git.

flynn1973 commented 1 year ago

default branch is master

yuki-kimoto commented 1 year ago

Could you show me show create table project after run sqlite3?

sqlite3 data/gitprep.db
flynn1973 commented 1 year ago

show create seems not to work anymoure, used schema instead...

root@lpgaixmgmtlx01:/var/www/gitprep/gitprep>sqlite3 data/gitprep.db
SQLite version 3.26.0 2018-12-01 12:34:55
Enter ".help" for usage hints.
sqlite> show create table project;
Error: near "show": syntax error
sqlite> show create table project
   ...>
   ...> ;
Error: near "show": syntax error
sqlite> .schema  project
CREATE TABLE project (
  row_id integer primary key autoincrement,
  user integer not null default 0,
  id not null, default_branch not null default 'master', original_project integer not null default 0, private integer not null default 0, ignore_space_change integer not null default 0, guess_encoding integer not null default '', website_url not null default '',
  unique(user, id)
);
sqlite>
yuki-kimoto commented 1 year ago

The definition seems to be correct.

default_branch not null default 'master'

Could you tell me the version of DBD::SQLite in the extlib directory.

flynn1973 commented 1 year ago

root@lpgaixmgmtlx01:/var/www/gitprep/gitprep>find . -name DBD* ./extlib/lib/perl5/ppc64le-linux-thread-multi/auto/DBD ./extlib/lib/perl5/ppc64le-linux-thread-multi/auto/share/dist/DBD-SQLite ./extlib/lib/perl5/ppc64le-linux-thread-multi/.meta/DBD-SQLite-1.66 ./extlib/lib/perl5/ppc64le-linux-thread-multi/DBD ./extlib/lib/perl5/ppc64le-linux-thread-multi/DBI/DBD ./extlib/lib/perl5/ppc64le-linux-thread-multi/DBI/DBD.pm

yuki-kimoto commented 1 year ago

Please install latest DBD-SQLite.

perl cpanm -L extlib DBD::SQLite
flynn1973 commented 1 year ago

same error after upgrade to latest DBD::SQLite

root@lpgaixmgmtlx01:/var/www/gitprep/gitprep>cpanm -L extlib DBD::SQLite
--> Working on DBD::SQLite
Fetching http://www.cpan.org/authors/id/I/IS/ISHIGAKI/DBD-SQLite-1.72.tar.gz ... OK
Configuring DBD-SQLite-1.72 ... OK
Building and testing DBD-SQLite-1.72 ... OK
Successfully installed DBD-SQLite-1.72 (upgraded from 1.66)
1 distribution installed
root@lpgaixmgmtlx01:/var/www/gitprep/gitprep/script>./import_rep -u aix /git
Can't creat repository ansible: DBD::SQLite::st execute failed: NOT NULL constraint failed: project.default_branch. Following SQL is executed.
insert into "project" ("default_branch", "user", "id") values (? , ? , ? )
(DBIx::Custom::execute) at (eval 103) line 1.
 at ./import_rep line 64.

Can't update description ansible
fatal: '/var/www/gitprep/gitprep/script/../data/rep/aix/ansible.git' does not appear to be a git repository
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
Can't push branches: git push /var/www/gitprep/gitprep/script/../data/rep/aix/ansible.git --all at ./import_rep line 102.
fatal: '/var/www/gitprep/gitprep/script/../data/rep/aix/ansible.git' does not appear to be a git repository
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
Can't push tags: git push /var/www/gitprep/gitprep/script/../data/rep/aix/ansible.git --tags at ./import_rep line 109.
Can't creat repository test: DBD::SQLite::st execute failed: NOT NULL constraint failed: project.default_branch. Following SQL is executed.
insert into "project" ("id", "default_branch", "user") values (? , ? , ? )
(DBIx::Custom::execute) at (eval 103) line 1.
 at ./import_rep line 64.

Can't update description test
fatal: '/var/www/gitprep/gitprep/script/../data/rep/aix/test.git' does not appear to be a git repository
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
Can't push branches: git push /var/www/gitprep/gitprep/script/../data/rep/aix/test.git --all at ./import_rep line 102.
fatal: '/var/www/gitprep/gitprep/script/../data/rep/aix/test.git' does not appear to be a git repository
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
Can't push tags: git push /var/www/gitprep/gitprep/script/../data/rep/aix/test.git --tags at ./import_rep line 109.
Can't creat repository ulb: DBD::SQLite::st execute failed: NOT NULL constraint failed: project.default_branch. Following SQL is executed.
insert into "project" ("id", "user", "default_branch") values (? , ? , ? )
(DBIx::Custom::execute) at (eval 103) line 1.
 at ./import_rep line 64.

Can't update description ulb
fatal: '/var/www/gitprep/gitprep/script/../data/rep/aix/ulb.git' does not appear to be a git repository
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
Can't push branches: git push /var/www/gitprep/gitprep/script/../data/rep/aix/ulb.git --all at ./import_rep line 102.
fatal: '/var/www/gitprep/gitprep/script/../data/rep/aix/ulb.git' does not appear to be a git repository
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
Can't push tags: git push /var/www/gitprep/gitprep/script/../data/rep/aix/ulb.git --tags at ./import_rep line 109.
Can't creat repository wikijs: DBD::SQLite::st execute failed: NOT NULL constraint failed: project.default_branch. Following SQL is executed.
insert into "project" ("user", "default_branch", "id") values (? , ? , ? )
(DBIx::Custom::execute) at (eval 103) line 1.
 at ./import_rep line 64.

Can't update description wikijs
fatal: '/var/www/gitprep/gitprep/script/../data/rep/aix/wikijs.git' does not appear to be a git repository
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
Can't push branches: git push /var/www/gitprep/gitprep/script/../data/rep/aix/wikijs.git --all at ./import_rep line 102.
fatal: '/var/www/gitprep/gitprep/script/../data/rep/aix/wikijs.git' does not appear to be a git repository
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
Can't push tags: git push /var/www/gitprep/gitprep/script/../data/rep/aix/wikijs.git --tags at ./import_rep line 109.
yuki-kimoto commented 1 year ago

This maybe a behavior changes for SQLite upgrading.

https://github.com/yuki-kimoto/gitprep/blob/master/lib/Gitprep/Manager.pm#L360

Please try the following change.

[Before]
$params->{default_branch} = $opts->{default_branch};

[After]
if (exists $opts->{default_branch}) {
  $params->{default_branch} = $opts->{default_branch}
}
flynn1973 commented 1 year ago

that worked, thank you.

root@lpgaixmgmtlx01:/var/www/gitprep/gitprep/script>./import_rep -u aix /git
Create repository ansible
Can't update description ansible
Enumerating objects: 314, done.
Counting objects: 100% (314/314), done.
Delta compression using up to 16 threads
Compressing objects: 100% (252/252), done.
Writing objects: 100% (1543/1543), 30.66 MiB | 41.92 MiB/s, done.
Total 1543 (delta 169), reused 59 (delta 29), pack-reused 1229
remote: Resolving deltas: 100% (550/550), done.
To /var/www/gitprep/gitprep/script/../data/rep/aix/ansible.git
 * [new branch]      master -> master
Everything up-to-date
Create repository test
Can't update description test
Enumerating objects: 5, done.
Counting objects: 100% (5/5), done.
Delta compression using up to 16 threads
Compressing objects: 100% (3/3), done.
Writing objects: 100% (5/5), 404 bytes | 404.00 KiB/s, done.
Total 5 (delta 0), reused 0 (delta 0), pack-reused 0
To /var/www/gitprep/gitprep/script/../data/rep/aix/test.git
 * [new branch]      master -> master
Everything up-to-date
Create repository ulb
Can't update description ulb
Enumerating objects: 116, done.
Counting objects: 100% (116/116), done.
Delta compression using up to 16 threads
Compressing objects: 100% (107/107), done.
Writing objects: 100% (116/116), 240.25 KiB | 120.13 MiB/s, done.
Total 116 (delta 7), reused 116 (delta 7), pack-reused 0
remote: Resolving deltas: 100% (7/7), done.
To /var/www/gitprep/gitprep/script/../data/rep/aix/ulb.git
 * [new branch]      master -> master
Everything up-to-date
Create repository wikijs
Can't update description wikijs
Enumerating objects: 135, done.
Counting objects: 100% (135/135), done.
Delta compression using up to 16 threads
Compressing objects: 100% (135/135), done.
Writing objects: 100% (135/135), 256.27 KiB | 12.20 MiB/s, done.
Total 135 (delta 74), reused 0 (delta 0), pack-reused 0
remote: Resolving deltas: 100% (74/74), done.
To /var/www/gitprep/gitprep/script/../data/rep/aix/wikijs.git
 * [new branch]      master -> master
Everything up-to-date
yuki-kimoto commented 1 year ago

Before closing, I will fix this bug in a few days.

Thank you for your contribution.