Skip to content

Instantly share code, notes, and snippets.

@prashantdsala
Created April 28, 2023 05:11
Show Gist options
  • Save prashantdsala/1aded830bfdca2210764fb044f37dcb8 to your computer and use it in GitHub Desktop.
Save prashantdsala/1aded830bfdca2210764fb044f37dcb8 to your computer and use it in GitHub Desktop.
Push to new or existing repository on github/gitlabs
// Git global setup
git config --global user.name "your git username"
git config --global user.email "your git email address"
// Create a new repository
git clone <.git url>
cd project_folder
touch README.md
git add README.md
git commit -m "add README"
git push -u origin master
// Push an existing folder
cd existing_folder
git init
git remote add origin <.git url>
git add .
git commit -m "Initial commit"
git push -u origin master
// Push an existing Git repository
cd existing_repo
git remote rename origin old-origin
git remote add origin <.git url>
git push -u origin --all
git push -u origin --tags
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment