amitsaha / gitbackup

Tool to backup your Bitbucket, GitHub and GitLab repositories
MIT License
194 stars 33 forks source link

Fix private repo cloning #76

Closed syphernl closed 2 years ago

syphernl commented 2 years ago

I separated the private repo check & https cloning as it made no sense (to me) to combine these two checks. On GitLab the repo.Private always seems to be false which prevented the useHttpsClone from being applied.

Tested locally on Gitlab.com and cloning private repos works fine now.

amitsaha commented 2 years ago

Thank you for your contribution.

I separated the private repo check & https cloning as it made no sense (to me) to combine these two checks.

The reason they are together (or, were) is that when the https cloning was added, it was added to support private repositories. But, perhaps that's not necessary.

On GitLab the repo.Private always seems to be false which prevented the useHttpsClone from being applied.

Interesting, i will have a look at this.

amitsaha commented 2 years ago

Thank you for your contribution.

I separated the private repo check & https cloning as it made no sense (to me) to combine these two checks.

The reason they are together (or, were) is that when the https cloning was added, it was added to support private repositories. But, perhaps that's not necessary.

On GitLab the repo.Private always seems to be false which prevented the useHttpsClone from being applied.

Interesting, i will have a look at this.

The Public field populated by the Go GitLab SDK doesn't seem to be working correctly. Here's an example of two projects which I created (one is private, the other is public):

$ GITLAB_TOKEN=glpat-W9wmBwqVeXWoyHyZgbT3 ./gitlab-go-demo  | grep "test-project"
NameWithNamespace: Amit Saha / test-project-1-public => Public field: false  => Visiblity => public
NameWithNamespace: Amit Saha / test-project-1-private => Public field: false  => Visiblity => private

The value of the Public field in both cases is false which is the bug here and i believe that leads to erroneous behavior in gitbackup too. I will get back to this.

amitsaha commented 2 years ago

Stop using the Public attribute for GitLab repositories: https://github.com/amitsaha/gitbackup/pull/78

amitsaha commented 2 years ago

Thanks @syphernl once again for the fix. I will merge this shortly along with the above PR which stops using the Public attribute.