将文件夹从本地计算机添加到github
我是git和github的新手.我正在尝试将本地计算机上的文件夹添加到github
I am new to git and github. I am trying to add a folder from my local machine to github
我已经做出了更改,当我尝试推送到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 <saishree999@gmail.com>
Date: Mon May 22 07:07:16 2017 +0530
added git commands file and deleted games.js files
commit 1b16729fdc52ad0fc394ae67e47f86d8ed363c1c
Author: Jayashree <saishree999@gmail.com>
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.
我应该使用什么命令将更改推送到github?
What command should I use to push my changes to github?
谢谢
通过执行以下命令运行来检查origin
是否已设置
Check origin
is set by running by executing below command
git remote -v
这将显示项目的所有push/fetch远程.验证远程名称/地址,它将显示类似于下一个的
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)
似乎设置了DAND
而不是origin
,所以下面的执行将失败
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
要更改遥控器的URL,请删除旧的遥控器,然后添加正确的遥控器.
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
然后尝试使用push
命令,它应该可以工作
Then try below push
command it should work
$git push origin master
根据远程名称origin
或DAND
更改远程Git存储库的URI(URL),如下所述使用它
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