0

there. I am creating a basic website with files and folders I need inside a GitHub repo. I have tried extensively to push these files, but, I get the error that my authentication is invalid even though my username and password are correct. Furthermore, sometimes, it gives me the error that the "remote origin already exists." I want to push these files to my existing repo, "webapp." Also, below, I deleted my name for obvious reasons but provided the output and all the things I have done.

  1. git init

Reinitialized existing Git repository in /Users/someone/PycharmProjects/allprojects/webpage/.git/


  1. $ git commit -m "first commit"

On branch main nothing to commit, working tree clean


  1. $ git remote add origin https://github.com/rishp66/webapp.git

fatal: remote origin already exists.


  1. git push -u origin main

Output:

Username for 'https://github.com': ...

Password for 'https://...@github.com':

I tried doing this with a personal access token as well for sometime as a password but that was invalid as well. Below are also logs of my previous commmits.

$ git log

commit 7dd2cb6954cf55f40ffc0c624f0d569ff23eab42 (HEAD -> main)

Author: N/A <my_email>

Date: Sat Feb 4 18:42:00 2023 -0500

first

commit 3bfbc0bc134a9d9bc885f19936894322ac7bf8b0 Author: N/A <my_email> Date: Sat Feb 4 17:23:25 2023 -0500

initial commit
konsolebox
  • 72,135
  • 12
  • 99
  • 105
rp963
  • 1

1 Answers1

0

If you already properly set up your ssh credentials, you can change your existing remote url to a git-ssh version using git remote set-url. For example:

git remote set-url origin git@github.com:rishp66/webapp.git
konsolebox
  • 72,135
  • 12
  • 99
  • 105