8

I have created one project. I want to store my project in Gitlab. How to create a local repository and remote repository in Gitlab using command line? I am looking for creating both local repository and remote repository creation.

I got the solution. Steps to create Local repository and remote repository using Gitlab.

  1. git init(Local repository created)
  2. git add .
  3. git commit -m "message"
  4. Git push using SSH(Remote repository created):

git push --set-upstream git@gitlab.example.com:your-username/nonexistent-project.git master

Git push using HTTP:

git push --set-upstream https://gitlab.example.com/your-username/nonexistent-project.git master
Pedram
  • 921
  • 1
  • 10
  • 17
Gobind
  • 588
  • 1
  • 7
  • 18
  • 2
    https://stackoverflow.com/questions/33101962/how-to-create-a-new-gitlab-repo-from-my-existing-local-git-repo-using-cli/42311714 this might help – Arghya Saha Aug 12 '18 at 17:47
  • 3
    Possible duplicate of [How to create a new gitlab repo from my existing local git repo, using CLI?](https://stackoverflow.com/questions/33101962/how-to-create-a-new-gitlab-repo-from-my-existing-local-git-repo-using-cli) – Prav Aug 12 '18 at 20:11
  • @PraveenP I was looking for creating both local repository and remote repository. The above question only answers about creating remote repository. So this is not a duplicate and also I got the solution for my question and mentioned in my question also. – Gobind Aug 13 '18 at 08:30

1 Answers1

14

Steps to create Local repository and remote repository using Gitlab.

  1. git init(Local repository created)
  2. git add .
  3. git commit -m "message"
  4. Git push using SSH(Remote repository created):

    git push --set-upstream git@gitlab.example.com:namespace/nonexistent-project.git master
    

    Git push using HTTP:

    git push --set-upstream https://gitlab.example.com/namespace/nonexistent-project.git master
    
FlyingFoX
  • 3,379
  • 3
  • 32
  • 49
Gobind
  • 588
  • 1
  • 7
  • 18