0

I have a problem similar to the question in this link but when I try the solutions on my side it doesn't work.

I created a new project named "example1". Then I create a repository on GitHub named "example1".

After committing all changes, I ran

git push origin master 

and came across this message:

$ git push origin master ssh: Could not resolve hostname github.com:Sidney-Dev: Name or service not known fatal: Could not read from remote repository. Please make sure you have the correct access rights and the repository exists. 

Then I added this command:

git remote add origin ssh://[email protected]:Example-Dev/example1.git 

And then checked:

$ git remote -v origin ssh://[email protected]:Sidney-Dev/laravelblog.git (fetch) origin ssh://[email protected]:Sidney-Dev/laravelblog.git (push) 

But when I try to do git push again, I still come across the same errors as mentioned above.

How can I push my code to the GitHub repository?

3 Answers 3

1

first, remove your origin:

git remote remove origin

then add it again...but without ssh://

git remote add origin [email protected]:Example-Dev/example1.git

You can copy the commands right from the gh initialization page.

Or you can read this: git ssh protocol

I guess it expects a port after : when you use the URL scheme

Sign up to request clarification or add additional context in comments.

Comments

0

The correct syntax for the ssh remote URL is either

[email protected]:Sidney-Dev/laravelblog.git 

or

ssh://[email protected]/Sidney-Dev/laravelblog.git 

Please note slash instead of colon.

2 Comments

@php So I first used git remote remove command...then used this: git remote add origin [email protected]:Sidney-Dev/laravelblog.git. when I run "git push origin master" it says that my current branch is behind, but when I run "git pull remote master" or "git pull" it says that my baccess rights are not correct, which is the same error I was getting.
current branch is behind and access rights are not correct are different problems. Your initial problem with incorrect ssh URL syntax is now fixed, as for the other problems you better ask new questions.
-1

You may have to manually go to the github website and create the repository, then do git pull on your master branch and open the project through git bash.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.