Why Is Git Push Origin Master Not Working?

462    Asked by DianeCarr in Big Data Hadoop , Asked on Aug 2, 2023

I had committed my change locally, but I am unable to push to origin master I am running the below-mentioned command:

$ git remote add origin git@github.com:username/test.git

I am seeing the below-mentioned command.
Fatal: remote origin already exists.
On running 
$ git push -u origin master
I am seeing the below-mentioned error
ERROR: Repository not found.
Fatal: The remote end hung up unexpectedly.

I want to know why is git push origin master not working?

Answered by Diane Carr

This error can be solved in two methods.


The first method is given below:
Git remote set-url
Example;- git remote set-url origin git@github.com:username/test.git
The next method is given below:
You must alter the origin setting. Edit .git/config in the project root, like the one mentioned below:
[remote “origin”]
Url = git://user@dev.foo.com/git/repos/path
Fetch = +refs/heads/*:refs/remotes/origin/*
In case the remote is local, the following command can be used.
[remote “origin’]
url=/path/to/repos/on/this/machine
Fetch = +refs/heads/*:refs/remotes/origin/*

In case the git push origin master does not work, you must edit the file with the preferred editor and modify the URL = setting to the modified location. Expecting that the new repository is properly created and there is the proper URL, you can push and pull from the new remote location. The Big Data Hadoop Training & Certification at JanBask Training offers experience like offline classes, saving students from the hassle of traveling to the physical location. The training provides a total Hadoop discipline preparation by teaching the core concept and techniques that the job role demands. The training also gives extensive training to impart fundamental and advanced concepts through interesting e-tools and expert-led Hadoop classes. Furthermore, JanBask Training helps you get job-ready and face the tough competitive market with confidence.



Your Answer

Interviews

Parent Categories