I am a bit curious about pushing a locally created folder(project) to Github. Is it possible? Please let me explain what I have already done. I am using Git for Windows on Windows 8.1 64-bit.
$ git init fresh-project Initialized empty Git repository in D:/MyDev/projects/fresh-project/.git/
2.
$ ls fresh-project/
**$ cd fresh-project**
**ls**
**$ git status**
On branch master
No commits yet
nothing to commit (create/copy files and use "git add" to track)
**Used $ code hipster.txt**
To create the file by opening VSCode and added some text.
**$ git status**
On branch master
No commits yet
Untracked files: (use "git add ..." to include in what will be committed) hipster.txt
nothing added to commit but untracked files present (use "git add" to track)
**$ git add hipster.txt**
**$ git status**
On branch master
No commits yet
Changes to be committed: (use "git rm --cached ..." to unstage) new file: hipster.txt
**$ git commit**
hint: Waiting for your editor to close the file... [main 2020-04-12T09:45:20.658Z] update#setState idle [main 2020-04-12T09:45:50.660Z] update#setState checking for updates [main 2020-04-12T09:45:50.870Z] update#setState idle [master (root-commit) b427f7c] Adding new file with hipster ipsum This was done with VSCode in 12th April 2020 15:20 1 file changed, 1 insertion(+) create mode 100644 hipster.txt
11.
$ git status On branch master nothing to commit, working tree clean
After the 11th step I want to push the whole local repository to Github.com. I haven't created a
repository in Github with the name of 'fresh-project'.
What else do I have to do to make this to happen?
Thanks and regards, Chiranthaka
You should have searched on github for this. It's easy all you need to do is first add files and commit then add remote repo url and push to github
$ git remote add origin https://github.com/user/yourremoterepo.git
If you want to create repo using command line you need to use Github api for that You need an access token and curl to POST repo
curl -H "Authorization: token ACCESS_TOKEN" --data '{"name":"Reponame"}' https://api.github.com/user/repos