[英]remote: Repository not found error in mac terminal
I am new to git.我是 git 新手。 I have a private repo and now I want to push the changes of my local to remote repo.
我有一个私人仓库,现在我想将本地仓库的更改推送到远程仓库。 However, I get an error:
但是,我收到一个错误:
remote: Repository not found.
fatal: repository 'https://github.com/co-csp/csm.git/' not found
What might cause these error and please help me how to solve it, I am using Mac terminal .什么可能导致这些错误,请帮助我如何解决它,我正在使用Mac 终端。 My username is john2 in github profile
git config user.name
and git config user.username
both gives john2
so username seems correct...我的用户名是john2在 github 配置文件
git config user.name
和git config user.username
了john2
所以用户名似乎是正确的...
If you are working with a private repository, do the following:如果您正在使用私有存储库,请执行以下操作:
This should prompt you to type in the GitHub password and should look like this.这应该会提示您输入 GitHub 密码,并且应该如下所示。
Cloning into 'csm'... Password for 'https://user@github.com':克隆到“csm”...“https://user@github.com”的密码:
You have two options here.您在这里有两个选择。 One option is to use
git clone
, the other options is git init
.一种选择是使用
git clone
,另一种选择是git init
。
Option 1: Use git clone
.选项 1:使用
git clone
。 In a new empty folder put the following command: git clone https://github.com/co-csp/csm.git
.在一个新的空文件夹中输入以下命令:
git clone https://github.com/co-csp/csm.git
。 You are ready to go.你准备好了。
Option 2: In the project folder, type git init
.选项 2:在项目文件夹中,键入
git init
。 This will initiate an empty new repository.这将启动一个空的新存储库。 It will create a
.git
folder inside.它会在里面创建一个
.git
文件夹。 Go to this folder by typing cd .git
.通过键入
cd .git
转到此文件夹。 Open the config
file with your favourite editor (mine is vim
).使用您喜欢的编辑器打开
config
文件(我的是vim
)。 You will see the following there:您将在那里看到以下内容:
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
ignorecase = true
Underneath, append the following:在下面,附加以下内容:
[remote "origin"]
url = https://github.com/co-csp/csm.git
fetch = +refs/heads/*:refs/remotes/origin/*
There are two possibilities why the Repository not found
error occurs:出现
Repository not found
错误有两种可能:
The remote repository does not exist .远程存储库不存在。 If you have already set up the remote URL, display it by typing
$ git remote -v
and check that you spelled everything correctly.如果您已经设置了远程 URL,请通过键入
$ git remote -v
来显示它并检查您是否拼写正确。 If you haven't added the remote URL yet, try $ git remote add origin [URL]
to do so.如果您还没有添加远程 URL,请尝试
$ git remote add origin [URL]
来$ git remote add origin [URL]
。 Also make sure you can find the repo on github;还要确保你可以在 github 上找到 repo; maybe the owner deleted or renamed it.
也许所有者删除或重命名了它。 To locally update the URL to your remote repository, type
$ git remote set-url origin [new-URL]
.要在本地更新远程存储库的 URL,请键入
$ git remote set-url origin [new-URL]
。 After that, type $ git remote show origin
to check whether git can find the remote repo now.之后,输入
$ git remote show origin
来检查 git 现在是否可以找到远程仓库。
The remote repository is private and you don't have access .远程存储库是私有的,您无权访问。 If the repository is private and you didn't authenticate correctly, git will give you the
Repository not found
error even if your remote repository URL is correct.如果存储库是私有的并且您没有正确进行身份验证,即使您的远程存储库 URL 正确,git 也会为您提供
Repository not found
错误。 Generally, you can authenticate by using either SSH keys or HTTPS.通常,您可以使用 SSH 密钥或 HTTPS 进行身份验证。 Using HTTPS, git should normally prompt you for your credentials when it needs them.
使用 HTTPS,git 通常会在需要时提示您输入凭据。 If it doesn't, try removing your local reference to the remote repo by typing
$ git remote rm origin
and re-add it using $ git remote add origin [URL]
.如果没有,请尝试通过键入
$ git remote rm origin
删除对远程仓库的本地引用,然后使用$ git remote add origin [URL]
重新添加它。 I personally prefer using SSH authentication with public and private keys, since it doesn't necessarily require any passwords.我个人更喜欢使用带有公钥和私钥的 SSH 身份验证,因为它不一定需要任何密码。 You might check out this link to set up SSH authentication for your GitHub, or simply google for it.
您可以查看此链接为您的 GitHub 设置 SSH 身份验证,或者直接使用谷歌搜索。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.