Sarvagya Gupta
Sarvagya Gupta

Reputation: 917

Push files to Github

I cloned my repo on my laptop and followed the steps:

git add .

git commit -m "First commit"

git remote add origin (repository URL)

git push -u origin master

but for some reason, I get a fatal error telling me that the repo not found. What's the issue?

Upvotes: 0

Views: 188

Answers (2)

VonC
VonC

Reputation: 1328732

You can refer to the official GitHub "Error: Repository not found" listing the main reasons:

  • spelling
  • permissions
  • ssh access (that is, if you have used an ssh url)
  • existence of the repo

In your case, the origin url is wrong:

git remote set-url origin https://github.com/USERNAME/REPOSITORY.git

In your case:

git remote set-url origin https://github.com/Flock1/Udacity.git

That won't change anything about the repo: you can add an push.

That is: you clone a full repo, not a folder within the repo.


error: failed to push some refs to 'https://github.com/Flock1/Udacity.git'  
  hint: Updates were rejected because the tip of your current branch is behind 
  hint: its remote counterpart

If your working tree is clean (meaning if git status reports there is no modification or untracked file), do:

git pull --rebase
git push

That will replay your commits on top of the updated upstream remote repo.

Upvotes: 1

MichaelSolati
MichaelSolati

Reputation: 2872

After adding the remote origin, run git remote -v to see if your remote git address(es) is/are listed.

From there you should ensure that your remote origin url looks right. A remote url should look like https://github.com/USERNAME/REPOSITORY.git.

If you need to remove an incorrect origin and assign a new one you can remove that remote with the following command git remote rm origin

Upvotes: 0

Related Questions