Push a Local Repository
Overview
This document provides the process that allows a user to populate a new GitLab repository with files stored on a local machine.
Assumptions and Prerequisites
The local project is a Git project, and all changes have been committed and are up to date locally. To push a local git project to an already existing remote repository, follow these steps:
- Navigate to the local git repository folder.
- Confirm a valid git repository.
- Run
git status.
- Run
- Run
git remote add origin < URL of remote repo >. - Run
git pull --set-upstream origin < branch name on remote repo > --allow-unrelated-histories. - Run
git push.
Steps
Follow these steps to populate files from your machine into a new repository in GitLab.
Navigate to the local Git repository folder.
- This implies the Git repository is valid, but to confirm, you can execute the command
git status.
- This implies the Git repository is valid, but to confirm, you can execute the command
Execute the following commands:
bashgit remote add origin < URL of remote repo >. git pull --set-upstream origin < branch name on remote repo > --allow-unrelated-histories. git push