1

Recently I made new project and with new repository on github.

But when I push to the new repository, it also tries to push to old repository which I never connected with the new project, Like this:

enter image description here

The old repo is in the same Github account with new repo, but it is connected to another project of mine (hence fail to push)

When I check my remote on my new project, it shows these

enter image description here

I tried to delete & change the url with set-url, or delete ... But the old url is still there

My .git/config file is

enter image description here

it doesn't have old repo url.

Pushing to new project is actually working well, but everytime I push to new one it always tries to push to old one & fails

3 Answers 3

1

This also happened to my Xcode project, so after digging in again I found out my own answer. The problem was on the global file.

How can i delete git user property? This answer helped me.

git config --global --unset remote.origin.url OLD.REPO.URL 

This finally solved the problem!

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

Comments

0

The output from git remove -v shows origin set to push to both the old and new repositories. Assuming you don't want this, you can try removing origin completely, then adding it back again with the correct settings:

git remote rm origin git remote add origin https://github.com/USERNAME/REPOSITORY.git 

and then

git push -u origin master 

9 Comments

Hi, thanks for the answer. Unfortunately, I tried this, but this didn't work. git remote rm origin removed my new repo url only, so when I put git remote set-url origin (new repo) there were still two urls remain. Seemed like the old repo url wasn't affected by all these git remote commands.
git remote add origin doesn't work, saying fatal: remote origin already exists. git remote rm origin doesn't remove my old repo url.
Can you try git remote remove origin? What version of Git are you using?
It's the same command, right? At least for me. I tried it before but result was the same. Version is git version 2.11.0 (Apple Git-81).
After running git remote rm origin try running git remote -v ... what do you now see?
|
0

Reading from your image error and hint. you can follow this way

  1. create a local branch
  2. checkout in local branch
  3. change your files or add files what ever want
  4. commit there
  5. than push it to master branch

you can do 1 and 2 by git checkout - b local_branch and then commit and push command.

1 Comment

Pushing to the old repository is not what I want. Git with this new project shouldn't be pushed to that old repo.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.