![]() ![]() The -f (or -force) flag stands for force. You can later perform git push and git pull commands without having to specify an origin. The command above shows -u (or -set-upstream) flag sets the remote origin as the upstream reference. Push to GitHub git push -u -f origin main The git remote add origin instructs git to add the URL of the default remote server for the repo. The “origin” is the default name git gives to a remote server. In git, remote refers to a remote version of the same repository. In this specific case, the message is: 'Added my project' Add a new remote origin git remote add origin In the above command, you will add your username and repo name. It is used for future reference to understand the commit. The -m (or -message) sets the message included with the commit. The git commit command creates a new commit with all added files. Commit the Added Files git commit -m 'Added my project' The git add command tells git which files to include in a commit, and the -A argument means “include all”. The git software recognizes and uses it to store all the metadata and version history for the project. You can skip the above command if you already have an initialized Git repository. Initialize the Git Repo.Įnsure that you are in the project's root directory that we push to GitHub. Initialize Git in the project folder.įrom the terminal, run the commands after going to the folder you would like to add. You have to replace these placeholders with your username and repo name. We assume your GitHub username is sammy, and the repo created is called my-new-project. It is not essential as we will override everything in the remote repository. You can either initialize a README or not. Create a GitHub Repoįirst, sign in to GitHub and create a new empty repo. ![]() Steps to Push an Existing Project to GitHub 1. You’ll require the following prerequisites to initialize the repo and push it to GitHub: Steps to Push an Existing Project to GitHub ![]()
0 Comments
Leave a Reply. |