

The -f switch forces Git to overwrite any files that already exist on GitLab with your existing project’s files.

To do this, issue a git push command with the name of the current branch along with the -f and -u switches. Once you have configured the remote reference to GitLab, you are ready to push your existing GitLab project. git remote add source Upload your existing project to GitLab This provides your local Git repo with the GitLab URL which was obtained earlier. To push and pull between your existing project and GitLab, you must issue a git remote add command. Git commit -m "Add existing project files before sending GitLab." Add GitLab as a remote reference Once the repository is set up, add all of the project’s files to the Git index and perform a commit: git add. If the current project does not yet use Git, perform a git init operation in the existing project’s root directory: git init Īfter you create the repository, find the option to clone the repo.Ĭopy the GitLab URL that points to the repository you just created.

In this tutorial, the repository is called a example-website. To do this, simply click on the “Create Repository” button in the GitLab online console and name the repository. To push a local development project to GitLab, you must first create a GitLab repository. These commands assume a GitLab repository named example-website and a user account named cameronmcnz. git commit -m "Push existing project to GitLab".Confirm that the files in the local project have been imported into GitLab.įor GitLab users who simply want a quick overview of the commands to run in the existing project to push to GitLab, here they are.Run a git push operation and use the -f and -u switches.

