3

This step return a fatal error.Can we create a repository via command line?I have a gitbash installed also.

D:\gitproject>git init
Initialized empty Git repository in D:/gitproject/.git/

D:\gitproject>touch README

D:\gitproject>git add README

D:\gitproject>git commit -m "first commit"
[master (root-commit) b7f79a0] first commit
 1 file changed, 0 insertions(+), 0 deletions(-)
 create mode 100644 README

D:\gitproject>git remote add origin https://github.com/lucycloud/NewRepo.git

D:\gitproject>git push origin master
AUTHENTICATION OK
AUTHENTICATION OK
remote: Repository not found.
fatal: repository 'https://github.com/username/NewRepo.git/' not found

D:\gitproject>git remote add origin https://github.com/username/NewRepo.git
fatal: remote origin already exists.

D:\gitproject>git push origin master
AUTHENTICATION OK
AUTHENTICATION OK
remote: Repository not found.
fatal: repository 'https://github.com/lucycloud/NewRepo.git/' not found

spicykimchi
  • 1,087
  • 5
  • 21
  • 34
  • You have to 1. create *empty* repo on github; 2. add remote to your local repo; 3. git push. You cannot create remote repositories from the local machine. – janos Dec 05 '13 at 05:27
  • In case readers don't notice, you can create a remote GitHub repo from the command line using the GitHub API. Refer to the answers to the referenced duplicate question. – NeilG Mar 12 '19 at 00:43

1 Answers1

3

The command git remote add origin https://github.com/lucycloud/NewRepo.git does not add a new repository on the remote machine. What it does is tell git on your current machine that it should expect a remote repository at the location you specified.

There is no way to create a new repository on the remote machine through git.

NaotaSang
  • 506
  • 3
  • 6