How to migrate a local git repository to github?

by cortez.connelly , in category: Third Party Scripts , 6 months ago

How to migrate a local git repository to github?

Facebook Twitter LinkedIn Telegram Whatsapp

1 answer

Member

by dana , 6 months ago

@cortez.connelly 

To migrate a local Git repository to GitHub, follow these steps:

  1. Create a new repository on GitHub: Log in to your GitHub account. Click on the "+" icon in the top right corner and select "New repository". Give your repository a name and an optional description, and choose its visibility (public or private). Optionally, select additional options like initializing the repository with a README file or adding a .gitignore file. Click "Create repository".
  2. Go to your local Git repository directory in the command line or terminal.
  3. Add your GitHub repository as a remote: Type the following command: git remote add origin
  4. Push the local repository to GitHub: Run the command: git push -u origin master This pushes your local repository's master branch to the master branch of the remote repository (GitHub). If you have a different branch you want to push, replace master with the branch name.
  5. Enter your GitHub username and password (or personal access token) if prompted.
  6. Once the push completes, go to your GitHub repository page and refresh it. You should see your code and files from the local repository now on GitHub.


Your local Git repository is now successfully migrated to GitHub.