Create a new repository and link with local - Anjum219/Git-basics GitHub Wiki
Create a new repository on GitHub. To avoid errors, do not initialize the new repository with README, license, or gitignore files. You can add these files after your project has been pushed to GitHub.
Open terminal or git bash and write the following commands
git initA local git instance is created with this command.
Now copy the remote link from repository clipboard and use it to link with local.
git remote add origin https://github.com/<user_name>/<repository_name>.gitRepository is added to local instance. Notice that, you are naming your remote as origin. Now to push the contents of local machine to the remote repository each time, you have to add, commit and push
git add .This adds all new/modified folders/files in the commit stage. If you want to add specific file/folder, use
git add <file_name>To add files of a specific extension, for example, all files with .cpp extension-
git add *.cppgit commit -m "commit message"Insert a useful commit message. The commit message should be simple and it should explain what feature/s you are trying to implement with the newly committed files.
git push origin masterThis will push the local changes to the remote repository. Here, master is the name of your local branch.