If you have a project that is already running on a remote server or on your local machine and you would like to move your code to GitHub here are the steps.
- Log into GitHub and create an empty git repository.
Make sure you do not initialize the repository with a README, gitignore or license. - Copy the SSH repository link
- On your server/local terminal type
git remote add origin git@github.com/account-name/repository-name.git - Check that this was added successfully by typing:
git remote -v
This should have an output silimar to this:
origin origin git@github.com/account-name/repository-name.git (fetch)
origin origin git@github.com/account-name/repository-name.git (fetch) - Now run the following command
git push origin main
This should generate a few lines in the terminal containing
Writing objects: 100% - Check your GitHub Repo to visually confirm that the repo was pushed
