Is it possible to create github repository for my project in Visual Studio Code, and commit all the files?
I have not found a single example where a repository is created from VSCode.
Is it possible to create github repository for my project in Visual Studio Code, and commit all the files?
I have not found a single example where a repository is created from VSCode.
Now, there is also a "Publish to Github" button in the "Source Control" part, when there is no git repository, to directly create a repository on github.
If you click on it, by default, VSCode propose (in the main bar) to create a private or a public repository with the project's folder name.
Just make a new file in VS Code. Local file created in VSCode
Go to Source Control. You will have an option to Initialize Repository, which inturn creates a repo in Github. Note : You need to connect to your github account before hand.
Use GitHub API to create repo. Outside of the API, there's no way to create a repo on GitHub via the command line.
curl -u 'username' https://api.github.com/user/repos -d '{"name":"projectname","description":"project desc"}'
git remote add origin git@github.com:nyeates/projectname.git
As far as I can tell, it's currently not possible with a default installation of VS Code. But you can make it work like this:
Add the REST API client by Huachao Mao to VS Code (others may work, haven't tested).
Create a personal access token in GitHub.
Create a new temporary file and enter the following text:
curl -u 'myGitHubUsername:myToken' "https://api.github.com/user/repos" -d '{"name":"MyNewRepo","description":"Repo Description"}'
Then select the line, press F1, look for "REST" in the search field and run the command "Rest Client: Send request"
After a short while you should be able to add the new remote repo using onboard tools.
Obviously, this is too elaborate for a one-time use. But once it's all set up, it's quite easy to create new repos or interact with the GitHub API in other ways.