How to push project source code to Gitlab ?
To push a project to GitLab, you will first need to create a repository for the project on GitLab. Once you have created the repository, you can follow these steps to push your local project to the remote repository on GitLab:
- Initialize a local Git repository for your project, if you haven’t already done so. Run
git init
in the root directory of your project. - Add the remote GitLab repository as a remote for your local repository. Run
git remote add origin git@gitlab.com:username/repo.git
, replacing "username" and "repo" with your GitLab username and the name of the repository you created on GitLab. - Add the files in your project to the local Git repository. Run
git add .
to add all files in the current directory and subdirectories, orgit add <file>
to add specific files. - Commit the added files to the local repository with a commit message. Run
git commit -m "Initial commit"
or your own commit message - Push the local repository to the remote repository on GitLab. Run
git push -u origin master
This will push the master branch of your local repository to the remote repository on GitLab, and the remote will be set as the default upstream repository, so you can use the command git push
in the future
Please note that the above command is git bash command, if you are using some other client you may use their respective command. Also this is general instruction, some slight changes might be required as per the organization setup.