DEV Community

A K I L A N
A K I L A N

Posted on

Day - 9 ( HOSTING PROJECT IN GIT LAB)

*After creating account in gitlab *
First we need to push our project from our local repo to remote repo

*how to do *
step1- Go to gitlab --> Click your profile ---> then left side 3rd option click the groups --> then click your project group and enter into your project file----> there you can see the code option in the right top click that ----> there select HTTP code ----> there are some 5 line commands

1.from the above

  • first need to open terminal from the place where the project file has

  • the give the cmd git status this show status of the git ----> then
    enter the first line git init --initial-branch=main --object-format=sha1

  • then next line----> .git remote add origin https://gitlab.com/akilan46-group/Akilan46-project.git then next line--->git add .

  • then next line---> git commit -m "Initial commit after enter this line we can expect an error.*Because we didn't generate token *

TO generate the token
steps should that follwed---->

click profile----> preference----> acesss----> personal access token-->generate token ----> legacey token..

  • Then past this linegit remote set-url origin https://<userName>:<token>@-project paths change the username , token ,project path..

  • After doing the above step enter the last line git commit -m "Initial commit"
    git push --set-upstream origin main
    ----> then peoject has push to your remote repo

*Hosting the peoject *

we need to add a file in the local folder called .gitlab-ci

pages:
  stage: deploy
  script:
    - mkdir public
    - cp -r * public/
  artifacts:
    paths:
      - public
  only:
    - main
Enter fullscreen mode Exit fullscreen mode

add manual the file in the local folder

open terminal

------> get status -----> cmd git add . -----> git commit m"hosting file"-----> git push.

  • the file we pushed is hosting file in gitlab the right side you can see the Git labpage

*That is host link you can click there and add / your file name *
the project will sucessfully host :

_If you found 404 error _ ----> go to setting---> general---> visibility---> page change acess to everyone.

Then the project will be visible to every via sharing the link

Top comments (0)