0

I'm a git newby and I'm having at least a couple of problems trying to get it to work for me. I'm also very frustrated about not having being able to articulate my problem clearly in earlier attempts despite my best efforts. So let's try this again, this time with a newer and, I hope, simpler problem. Then I'll ask the more complicated question again in another post.

This problem is easy to state: I can't push my local repo to my remote repo at all: git claims it can't see any such repo.

I created a project on my development laptop which is running Windows 10 and the latest version of git bash, which I upgraded via git update-git-for-windows. I had an existing project named Sandbox and decided to create a local repo for it. I executed these commands from within its directory, C:\Vue\Sandbox:

git init
git add . 
git commit -m 'initial commit'

Then, I created a remote repo, also called Sandbox, on GitHub, and then executed this command:

git remote add origin https://github.com/[MyID]/Sandbox.git

Then this command:

git remote -v

produces this result:

origin  https://github.com/[MyID]/Sandbox.git (fetch)
origin  https://github.com/[MyID]/Sandbox.git (push)

This all looks great to me so far. The next thing I try is:

git push -u origin master

Much to my dismay and confusion, that fails:

remote: Repository not found.
fatal: repository 'https://github.com/[MyID]/Sandbox.git/' not found

WHY?? I'm absolutely certain that the URL for the remote is correct, I've typed it exactly from the GitHub page and I'm a pretty accurate typist.

What have I done wrong? What do I have to do to make my push work correctly?

EDIT: Okay, I read the other question and replies and they suggested doing this:

git remote rm origin
git remote add origin https://USERNAME:PASSWORD@github.com/[MyID]/Sandbox.git

I did that and it no longer tries to tell me the repo doesn't exist but gives me this error instead:

$ git push -u origin master
Enumerating objects: 124, done.
Counting objects: 100% (124/124), done.
Delta compression using up to 4 threads
Compressing objects: 100% (123/123), done.
Writing objects: 100% (124/124), 2.35 MiB | 778.00 KiB/s, done.
Total 124 (delta 7), reused 0 (delta 0), pack-reused 0
remote: Resolving deltas: 100% (7/7), done.
remote: error: GH007: Your push would publish a private email address.
remote: You can make your email public or disable this protection by visiting:
remote: http://github.com/settings/emails
To https://github.com/[MyID]/Sandbox.git
 ! [remote rejected] master -> master (push declined due to email privacy restrictions)
error: failed to push some refs to 'https://github.com/[MyID]/Sandbox.git'

Earlier today, as I was reading about git and github, I saw a caution about putting my real email address on my repos for people to see; it's a real privacy issue and I do want to protect my privacy so I went into GitHub and made my email address private. It issued me a surrogate email address which was [8-digit-number]+[MyID]@users.noreply.github.com

Is THAT why I'm getting this new error? If so, what do I need to do so that my pushes will work? I'm guessing maybe I need to do this:

git config --global email.address [8-digit-number]+[MyID]@users.noreply.github.com 

Or is there some other technique I need to use?

Henry
  • 1,395
  • 1
  • 12
  • 31
  • 2
    Is your repo public? If not, does your Git CLI know how to authenticate with Github? – user229044 Nov 29 '20 at 01:16
  • https://stackoverflow.com/search?q=%5Bgithub%5D+remote%3A+Repository+not+found – phd Nov 29 '20 at 01:20
  • @meagar - the repo is private. I don't know the answer to your second question. How can I determine the answer? – Henry Nov 29 '20 at 03:42
  • https://stackoverflow.com/questions/43863522/error-your-push-would-publish-a-private-email-address?r=SearchResults – matt Nov 29 '20 at 03:48
  • And in particular, https://stackoverflow.com/a/51097104/341994 – matt Nov 29 '20 at 03:51
  • @matt - Your second suggestion was particularly helpful. I tried just setting my email.address to the surrogate value but that didn't work so I unchecked the box that privatized the email and was finally able to push to the repository. Now I'm going to re-check the privatize button and adjust my email address back to the surrogate. Thanks for your help! – Henry Nov 29 '20 at 04:12

0 Answers0