Jayashree
Jayashree

Reputation: 825

Adding a folder from local machine to github

I am new to git and github. I am trying to add a folder from my local machine to github

I committed the changes and when I am trying to push to github I am facing challenges.

Here's the list of commands I tried but getting errors.

JAYASHREE ~ $ cd "C:\Users\JAYASHREE\Desktop\Data Analyst Nanodegree"
JAYASHREE (master *) Data Analyst Nanodegree $ git push origin remote
error: src refspec remote does not match any.
error: failed to push some refs to 'origin'
JAYASHREE (master *) Data Analyst Nanodegree $ git push origin master
fatal: 'origin' does not appear to be a git repository
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
JAYASHREE (master *) Data Analyst Nanodegree $ git push  remote master
fatal: 'remote' does not appear to be a git repository
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
JAYASHREE (master *) Data Analyst Nanodegree $ git log
commit 81bbf5e5f72ef4ec5dc08cd989a61e13899c8c7b
Author: Jayashree <[email protected]>
Date:   Mon May 22 07:07:16 2017 +0530

    added git commands file and deleted games.js files

commit 1b16729fdc52ad0fc394ae67e47f86d8ed363c1c
Author: Jayashree <[email protected]>
Date:   Sun May 21 17:30:58 2017 +0530

    Data Analyst folder
JAYASHREE (master *) Data Analyst Nanodegree $ git remote add DAND https://github.com/jayashreesridhar
JAYASHREE (master *) Data Analyst Nanodegree $ git push remote master
fatal: 'remote' does not appear to be a git repository
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
JAYASHREE (master *) Data Analyst Nanodegree $ git push origin master
fatal: 'origin' does not appear to be a git repository
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

What command should I use to push my changes to github?

Thanks

Upvotes: 0

Views: 501

Answers (2)

Keshan Nageswaran
Keshan Nageswaran

Reputation: 8188

Check origin is set by running by executing below command

git remote -v

This shows you all of the push / fetch remotes for the project.Verify remote name / address, It will show something similar to below one

$git remote -v
DAND https://github.com/jayashreesridhar/repository-name.git (fetch)

Seems like DAND is set instead of origin so below execution will fail

$git push origin master

Instead you need to use like this

   $git push DAND master

To change the remote's URL, remove the old remote, and then add the correct one.

$git remote remove DAND 

You can then add in the proper remote using

$git remote add origin https://github.com/jayashreesridhar/repository-name.git

Then try below push command it should work

   $git push origin master

Change the URI (URL) for a remote Git repository depending on the remote name either origin or DAND use it as below

git remote set-url (origin | DAND) https://github.com/jayashreesridhar/repository-name.git

Upvotes: 1

Jeff Puckett
Jeff Puckett

Reputation: 41021

By the looks of this command

git remote add DAND https://github.com/jayashreesridhar

You've named your remote DAND so

git push DAND master

But that doesn't look like the repository url, but rather your profile.

It should probably be something like

 git remote set-url DAND https://github.com/jayashreesridhar/repository-name.git

Then push again

git push DAND master

Or just name your remote origin per the standard convention

git remote add origin https://github.com/jayashreesridhar/repository-name.git

Then push normally

git push origin master

You can check what remotes you've already got with

git remote -v

Upvotes: 0

Related Questions