Open the "Create a new project" dialog If the Visual Studio development environment is already open, you can create a new project by choosing File > New > Project on the menu bar. You can also select the New Project button on the toolbar, or press Ctrl+Shift+N.
Follow these two steps: Create the repository online using the link: https://github.com/new. Then link your local repo to the remote repo using the command: git add remote origin https://github.com/userName/repo.git Here the repo. git will be your newly created remote repo.
Here are the detailed steps needed to achieve this.
The existing commands can be simply run via the CLI terminal of VS-CODE. It is understood that Git is installed in the system, configured with desired username and email Id.
1) Navigate to the local project directory and create a local git repository:
git init
2) Once that is successful, click on the 'Source Control' icon on the left navbar in VS-Code.One should be able to see files ready to be commit-ed. Press on 'Commit' button, provide comments, stage the changes and commit the files. Alternatively you can run from CLI
git commit -m "Your comment"
3) Now you need to visit your GitHub account and create a new Repository. Exclude creating 'README.md', '.gitIgnore' files. Also do not add any License to the repo. Sometimes these settings cause issue while pushing in.
4) Copy the link to this newly created GitHub Repository.
5) Come back to the terminal in VS-CODE and type these commands in succession:
git remote add origin <Link to GitHub Repo> //maps the remote repo link to local git repo
git remote -v //this is to verify the link to the remote repo
git push -u origin master // pushes the commit-ed changes into the remote repo
Note: If it is the first time the local git account is trying to connect to GitHub, you may be required to enter credentials to GitHub in a separate window.
6) You can see the success message in the Terminal. You can also verify by refreshing the GitHub repo online.
Hope this helps
This feature was added in 1.45, demoed here.
Launch the command palette Ctrl+Shift+P
, run Publish to Github
, and follow the prompt. You will be given the choice between a private and public repository, so be careful that you choose the right one.
It may ask you to login to github. It will then prompt for the repo name (defaults to the name of the folder), and for creating a .gitignore file (defaults to empty .gitignore). Just hit enter if you are fine with the defaults. When you are done it should give you a popup notification in the bottom right with a link to the repo https://github.com/<username>/<reponame>
Minor warning: if your project already has a .gitignore file in it this process will overwrite it
Well, It's quite easy.
Open your local project.
Add a README.md
file (If you don't have anything to add yet)
Click on Publish on Github
Choose as you wish
Choose the files you want to include in firt commit.
Note: If you don't select a file or folder it will added to .gitignore
file
You are good to go. it is published.
P.S. If this was you first time. A prompt will ask for for your Github Credentials fill those and you are good to go. It is published.
Install git on your PC and setup configuration values in either Command Prompt (cmd) or VS Code terminal (Ctrl + `
)
git config --global user.name "Your Name"
git config --global user.email [email protected]
Setup editor
Windows eg.:
git config --global core.editor "'C:/Program Files/Notepad++/notepad++.exe' -multiInst -nosession"
Linux / Mac eg.:
git config --global core.editor vim
Check git settings which displays configuration details
git config --list
Login to github and create a remote repository. Copy the URL of this repository
Navigate to your project directory and execute the below commands
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
today is 2020-12-25, my VSC is 1.52.1, tried all above not very successful. Here is complete steps I did to add my existing local project to GitHub using VSC (Note: Do not create a corresponding repository at GitHub):
<your username>/<your new repository name>
. For example, my username is "myname" and my local folder is named "HelloWorld". So, it will be myname/HelloWorld
in the type-in box.I think I ran into the similar problem. If you started a local git repository but have not set up a remote git project and want to push your local project to to git project.
1) create a remote git project and note the URL of project
2) open/edit your local git project
3) in the VS terminal type: git push --set-upstream [URL of project]
Push code on git hub in V S code
git init
git add .
git commit -m " test this app"
git remote add origin https://github.com/username/flutterapp.git
git push or
git push --set-upstream origin master
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With