unable to push first attempt from local machine to github repo

Thank you for your time.

I am very new so please excuse my lack of knowledge.

While attempting to push a local file into a repo in my GitHub I consistently receive this message in my terminal. fatal: remote error:

I have tried contacting as many people as I know to help solve this with no luck.
I have tired created new directors in my terminal and files to push into the Github repo.
I have tired creating new github repos with no luck. 
I am at a loss as to why I cannot push these files into my repo.

Please help

erins-Air:tryagin erinclaudio$ git status
On branch master
No commits yet
Changes to be committed:
(use “git rm --cached <file>…” to unstage)
new file: trytrytry.txt
erins-Air:tryagin erinclaudio$ git commit -m ‘first’
[master (root-commit) 90680d6] first
1 file changed, 1 insertion(+)
create mode 100644 trytrytry.txt
erins-Air:tryagin erinclaudio$ git status

On branch master

nothing to commit, working tree clean

erins-Air:tryagin erinclaudio$ git remote add origin https://github.com/healthkey/latenight.git

erins-Air:tryagin erinclaudio$ git push -u origin master

fatal: remote error:

You can’t push to git://github.com/healthkey/latenight.git

Use https://github.com/healthkey/latenight.git

erins-Air:tryagin erinclaudio$

Hi @erinclaudio,

Welcome to the Github Community Forum!

Everything seems ok, did you run other commands different than these?

-Gabriele-

Mark helpfull posts with Accept as Solution to help other users locate important info. Don’t forget to give Kudos for great contents!

1 Like

Sorry I am new to using this feature of Github please find the most recent attempt through the command line and not through VS Code

(base) erins-Air:Desktop erinclaudio$ ls

Complete-Python-3-Bootcamp-master	guessing_game

Projects nextversion_dd.py

Relocated Items sorry for the formatting.docx

blackjack _start.py udemy_python_course_review-master

dd_practice.py ~$ashCards I1.docx

dd_wednesday_keith_class_vscode.py

(base) erins-Air:Desktop erinclaudio$ cd blackjack\ _start.py

-bash: cd: blackjack _start.py: Not a directory

(base) erins-Air:Desktop erinclaudio$ cd Projects/

(base) erins-Air:Projects erinclaudio$ ls

Lawn care crispy-funicular	trash_dd

ViewFile.pdf docs_to_be_saved	ubiquitous-train

blackjack_v1 tic_tac_toe_dd version2_GH_dd

(base) erins-Air:Projects erinclaudio$ cd blackjack_v1/

(base) erins-Air:blackjack_v1 erinclaudio$ git init

Initialized empty Git repository in /Users/erinclaudio/Desktop/Projects/blackjack_v1/.git/

(base) erins-Air:blackjack_v1 erinclaudio$ git add .

(base) erins-Air:blackjack_v1 erinclaudio$ git commit -m "first commit"

[master (root-commit) 2d6e744] first commit

 2 files changed, 39 insertions(+)

 create mode 100644 blackjack _start.py

 create mode 100644 new file

(base) erins-Air:blackjack_v1 erinclaudio$ git remote add origin https://github.com/ErinClaudio/super-fiesta.git

(base) erins-Air:blackjack_v1 erinclaudio$ git push -u origin master

fatal: remote error:

  You can't push to git://github.com/ErinClaudio/super-fiesta.git

  Use https://github.com/ErinClaudio/super-fiesta.git

(base) erins-Air:blackjack_v1 erinclaudio$ git remote set-url https://github.com/ErinClaudio/super-fiesta.git

usage: git remote set-url [--push] <name> <newurl> [<oldurl>]

   or: git remote set-url --add <name> <newurl>

   or: git remote set-url --delete <name> <url>



    --push manipulate push URLs

    --add add URL

    --delete delete URLs



(base) erins-Air:blackjack_v1 erinclaudio$ git remote set-url --add .

usage: git remote set-url [--push] <name> <newurl> [<oldurl>]

   or: git remote set-url --add <name> <newurl>

   or: git remote set-url --delete <name> <url>



    --push manipulate push URLs

    --add add URL

    --delete delete URLs



(base) erins-Air:blackjack_v1 erinclaudio$ git remote set-url ErinClaudio/super-fiesta.git

usage: git remote set-url [--push] <name> <newurl> [<oldurl>]

   or: git remote set-url --add <name> <newurl>

   or: git remote set-url --delete <name> <url>



    --push manipulate push URLs

    --add add URL

    --delete delete URLs



(base) erins-Air:blackjack_v1 erinclaudio$ git remote set-url <https://github.com/ErinClaudio/super-fiesta.git>

-bash: syntax error near unexpected token `newline'

(base) erins-Air:blackjack_v1 erinclaudio$ git remote set-url https://github.com/ErinClaudio/super-fiesta.git

usage: git remote set-url [--push] <name> <newurl> [<oldurl>]

   or: git remote set-url --add <name> <newurl>

   or: git remote set-url --delete <name> <url>



    --push manipulate push URLs

    --add add URL

    --delete delete URLs



(base) erins-Air:blackjack_v1 erinclaudio$ git remote set-url origin eclaudio@gmail.com:ErinClaudio/super-fiesta.git

(base) erins-Air:blackjack_v1 erinclaudio$ git push

fatal: The current branch master has no upstream branch.

To push the current branch and set the remote as upstream, use



    git push --set-upstream origin master



(base) erins-Air:blackjack_v1 erinclaudio$ git push -u origin master

ssh: connect to host gmail.com port 22: Operation timed out

fatal: Could not read from remote repository.



Please make sure you have the correct access rights

and the repository exists.

(base) erins-Air:blackjack_v1 erinclaudio$

Welcome back, I will try to explain you every command you type.

  • The CD command:

(base) erins-Air:Desktop erinclaudio$ ls

Complete-Python-3-Bootcamp-master guessing_game

Projects nextversion_dd.py

Relocated Items sorry for the formatting.docx

blackjack _start.py udemy_python_course_review-master

dd_practice.py ~$ashCards I1.docx

dd_wednesday_keith_class_vscode.py

(base) erins-Air:Desktop erinclaudio$ cd blackjack\ _start.py

-bash: cd: blackjack _start.py: Not a directory

(base) erins-Air:Desktop erinclaudio$ cd Projects/

(base) erins-Air:Projects erinclaudio$ ls

Lawn care crispy-funicular trash_dd

ViewFile.pdf docs_to_be_saved ubiquitous-train

blackjack_v1 tic_tac_toe_dd version2_GH_dd

(base) erins-Air:Projects erinclaudio$ cd blackjack_v1/

    The command cd stands for change directory and you had try to change directory on the console with a input that was a file. Then you go to the blackjack_v1/ using a cd cascade commands, you can do it with only one command:

cd Projects/blackjack_v1/
  • git init create all the file used by git to version control your project by creating the .git directory inside the project.

(base) erins-Air:blackjack_v1 erinclaudio$ git init

Initialized empty Git repository in /Users/erinclaudio/Desktop/Projects/blackjack_v1/.git/

  • git add . move all the file recursively from where you are to the stage area.

(base) erins-Air:blackjack_v1 erinclaudio$ git add .

(base) erins-Air:blackjack_v1 erinclaudio$ git commit -m “first commit”

[master (root-commit) 2d6e744] first commit

2 files changed, 39 insertions(+)

create mode 100644 blackjack _start.py

create mode 100644 new file

  • git commit -m “first commit” create a commit on the history of the project and give it a description that contain “first commit”

(base) erins-Air:blackjack_v1 erinclaudio$ git commit -m “first commit”

[master (root-commit) 2d6e744] first commit

2 files changed, 39 insertions(+)

create mode 100644 blackjack _start.py

create mode 100644 new file

The output given can be translate with: the commit created in the master branch is a the first commit of the repository ( root-commit ) with a sha id 2d6e744  and the description of the commit is first commit. In this commit 2 files changed with 39 new insertions. In create mode is created a file (relative code 100644 ) with the name blackjack_start.py. Same as the second file.

  • git remote add origin <url> set a remote called origin with some url

(base) erins-Air:blackjack_v1 erinclaudio$ git remote add origin https://github.com/ErinClaudio/super-fiesta.git

this create a file inside a .git directory where all the data about this remote will be stored. This rapresent the comunication channel with the git server hosted by github.

  • git push -u origin master gives you an error.

(base) erins-Air:blackjack_v1 erinclaudio$ git push -u origin master

fatal: remote error:

You can’t push to git://github.com/ErinClaudio/super-fiesta.git

Use https://github.com/ErinClaudio/super-fiesta.git

Probably the first try you had done is by using the ssh url gitven by github, but maybe this ssh connection is no more valid. Check out the settings of your account in the SSH and GPG keys.

Solution:

If you want to solve the problem in a more confortable way, you need to follow this steps:

  1. Delete the actual remote reference:

    git remote remove origin

  2. Now there are no remote in use called origin, then use the https url of the project and add a new remote:

    git remote add origin https://github.com/ErinClaudio/super-fiesta.git

3 Push the master branch into the origin remote repository:

git push origin master
  1. Those should be working

Ask if you have more questions

-Gabriele-

Mark helpfull posts with Accept as Solution to help other users locate important info. Don’t forget to give Kudos for great contents!

1 Like