Clone a github repo into a private gitlab repo
I suspect you are getting that error because the default configuration of a repository in gitlab is to have a default branch name of master
. You have only pushed a branch named develop
, and when you clone the repository git is attempting to checkout the nonexistent master
branch.
You can:
go into the repository settings in gitlab and set the default branch to
develop
,or you can just name the branch
master
,or you can provide
-b develop
to thegit clone
command,or after cloning you can simply
git checkout develop
.
Related videos on Youtube
lostintranslation
Updated on September 15, 2022Comments
-
lostintranslation over 1 year
I am trying to pull a repo from github and push it up to a private repo on a gitlab server that I am running.
I cloned the github repo to my local machine
git clone https://github.com/somepage/someproject
at that point I added a new remote (my gitlab)
git remote add gitlab https://mygitlabserver/mypage/myproject
then I pushed (in this case only branch on githab was develop)
git push gitlab develop
Now I am running into problems when I try to clone from my gitlab repo:
git clone https://mygitlabserver/mypage/myproject Cloning into 'myproject'... remote: Counting objects: 140, done. remote: Compressing objects: 100% (85/85), done. remote: Total 140 (delta 40), reused 140 (delta 40) Receiving objects: 100% (140/140), 2.75 MiB | 1.85 MiB/s, done. Resolving deltas: 100% (40/40), done. Checking connectivity... done. warning: remote HEAD refers to nonexistent ref, unable to checkout.
Not 100% what that warning is about, but I am sure its not good. If I list the contents of that cloned dir its empty.
What did I do wrong?
-
lostintranslation about 9 yearsYou are correct. Seems like gitlab has no idea what to do if the default branch is not master. Thanks!