How to push code to github from vscode

In this article let’s discuss about How to push code to github from vscode. Let’s go through the following methods without any delay.

Method 1:

git init                                                           // start tracking current directory
git add -A                                                         // add all files in current directory to staging area, making them available for commit
git commit -m "commit message"                                     // commit your changes
git remote add origin https://github.com/username/repo-name.git    // add remote repository URL which contains the required details
git pull origin master                                             // always pull from remote before pushing
git push -u origin master                                          // publish changes to your remote repository

If you are facing any issues with the above approach then try the alternative that is given below. It may look similar but have a try!

Method 2 :

git init                                                           // start tracking current directory
git add -A                                                         // add all files in current directory to staging area, making them available for commit
git commit -m "commit message"                                     // commit your changes
git remote add origin https://github.com/username/repo-name.git    // add remote repository URL which contains the required details
git pull origin master                                             // always pull from remote before pushing
git push -u origin master  

Hope the above solution works.

Realted Posts : How to set alias in ubuntu