Ricardo Fornes
Ricardo Fornes

Reputation: 392

Git remote command returns fatal: Invalid refspec +refs/heads/*:refs/remotes/:origin/*

I accidentally modified my git config file and now hitting git remote --v in the terminal it returns: fatal: Invalid refspec '+refs/heads/*:refs/remotes/:origin/*',

What could be wrong in my config file, this is how it looks:

[core]
    repositoryformatversion = 0
    filemode = true
    bare = false
    logallrefupdates = true
[remote "origin"]
    url = ssh://[email protected]/myuserame/repo.git
    fetch = +refs/heads/*:refs/remotes/:origin/*

Any idea will be appreciated, Thanks.

Upvotes: 11

Views: 29109

Answers (2)

Robert Sandfield
Robert Sandfield

Reputation: 11

You can safely delete the [remote "origin"] section from your config file and reinitialize the remote settings in the CLI as if you had not yet done it for the repository in the first place.

Upvotes: 1

VonC
VonC

Reputation: 1329572

You can fix it with a:

git config remote.origin.fetch refs/heads/*:refs/remotes/origin/*

(removing the : in :origin)

Upvotes: 20

Related Questions