Reputation: 276
I am new to 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. My username is john2 in github profile git config user.name
and git config user.username
both gives john2
so username seems correct...
Upvotes: 11
Views: 42221
Reputation: 4993
Use SSH URL Instead of HTTPS:
If you were using an HTTPS URL initially, try switching to the SSH URL. Update the remote URL using the following command:
git remote set-url origin [email protected]:username/repo.git
Replace username with your GitHub username and repo.git with your repository name
Upvotes: 0
Reputation: 357
I had the same problem
The error was that I had store my personal credentials of github and when tried to made git clone in the terminal automatically set this old credential.
You need to clean your old github credential, logout your github account in VS and to make sure (in Mac -> Keychain Access delete the github crendential)
Setup your personal token in github
Login with the new token
$ git clone https://github.com/USERNAME/REPO.git
Username: YOUR_USERNAME
Password: YOUR_TOKEN```
and done!
Upvotes: 1
Reputation: 1146
Updating credentials from the macOS Keychain
Method 1: Updating your credentials via Keychain Access
Method 2: Deleting your credentials via the command line
Through the command line, you can use the credential helper directly to erase the keychain entry.
$ git credential-osxkeychain erase
host=github.com
protocol=https
> [Press Return]
Upvotes: 5
Reputation: 380
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.
Cloning into 'csm'... Password for 'https://[email protected]':
Upvotes: 7
Reputation: 81
There are two possibilities why the Repository not found
error occurs:
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. If you haven't added the remote URL yet, try $ git remote add origin [URL]
to do so. Also make sure you can find the repo on github; maybe the owner deleted or renamed it. To locally update the URL to your remote repository, type $ git remote set-url origin [new-URL]
. After that, type $ git remote show origin
to check whether git can find the remote repo now.
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. Generally, you can authenticate by using either SSH keys or HTTPS. Using HTTPS, git should normally prompt you for your credentials when it needs them. 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]
. I personally prefer using SSH authentication with public and private keys, since it doesn't necessarily require any passwords. You might check out this link to set up SSH authentication for your GitHub, or simply google for it.
Upvotes: 2
Reputation: 269
You have two options here. One option is to use git clone
, the other options is git init
.
Option 1: Use git clone
. In a new empty folder put the following command:
git clone https://github.com/co-csp/csm.git
. You are ready to go.
Option 2: In the project folder, type git init
. This will initiate an empty new repository. It will create a .git
folder inside. Go to this folder by typing cd .git
. Open the config
file with your favourite editor (mine is 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/*
Upvotes: 0