Skip to content

Instantly share code, notes, and snippets.

@canxerian
Created June 7, 2022 12:12
Show Gist options
  • Save canxerian/4265da0d65046e54ba7553a618bb1d47 to your computer and use it in GitHub Desktop.
Save canxerian/4265da0d65046e54ba7553a618bb1d47 to your computer and use it in GitHub Desktop.
Make a local git repo remote, i.e track GitHub, GitLab, DevOps etc
# Suppose you've been working on a local repo and now wish to host it on GitHub, GitLab, Azure DevOps etc.
# These git commands will enable you to do so whilst keeping history intact
# 1. Use the GitHub/GitLab/DevOps web interface to create the repo.
# Copy the URL to the repo (https option).
# 2. In your repo, add it as a remote
git remote add origin <REMOTE_URL>
# 3. Push your changes to the remote repo
git push origin <NAME_OF_LOCAL_BRANCH>
# That's it!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment