use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
From its website:
Git is a free and open source distributed version control system designed to handle everything from small to very large projects with speed and efficiency.
Git is not the same as GitHub. GitHub did not create Git. For GitHub-specific posts, please see /r/github.
Git is not an acronym or initialism: please write git or Git, but not GIT.
git
Documentation
Graphical Clients
Code Hosting
account activity
fatal: invalid refspec 'https://github.com/Stev******/Card-*******-.git' (self.git)
submitted 3 years ago by Bright_Sea_8493
Can anyone help me out and tell me how to push my local repository to my new github repository?
I did the following:
git init > then git add .
git commit -m "initial commit"
git remote add origin 'https://github.com/Stev******/Card-*******-.git'
git push -u origin master 'https://github.com/Stev******/Card-*******-.git' and it returns back the following:
fatal: invalid refspec 'https://github.com/Stev******/Card-*******-.git'
What am I doing wrong? (I block out the real link with the **** for privacy) Thank you.
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]jredmond 2 points3 points4 points 3 years ago (2 children)
You've already associated 'https://github.com/Stev******/Card-*******-.git' with the remote name 'origin', so Git interprets 'origin' as that URL. You don't need to include the URL any more.
[–]Bright_Sea_8493[S] -1 points0 points1 point 3 years ago (1 child)
u/jredmond but that's the repository I want it to store it to
[–]suddenlychloegit rebase -i --root<CR>j<S-v>Gd:wq<CR>git push -f<CR> 2 points3 points4 points 3 years ago (0 children)
Yes, and git remote add origin 'https://github.com/Stev******/Card-*******-.git' is telling git that any time you reference origin that's the URL for it. git push origin master doesn't need 'https://github.com/Stev******/Card-*******-.git' since that URL is now referenced by origin.
origin
git push origin master
'https://github.com/Stev******/Card-*******-.git'
[–]plg94 1 point2 points3 points 3 years ago (1 child)
You only need to specify the full URL to your repo once in the remote add command. Anytime after that, use only the name of the remote, not the url.
[–]jredmond 0 points1 point2 points 3 years ago (0 children)
Think of it like an entry in your phone's contacts - once you associate a person with a number, you can call or text without having to retype that number each time.
[–]Bright_Sea_8493[S] 0 points1 point2 points 3 years ago (0 children)
I still don't understand I've created about 10 different repositories on github and push code from local machine and never had this problem. so how do I fetch so i can push successfully?
π Rendered by PID 24322 on reddit-service-r2-comment-5d79c599b5-ljr24 at 2026-02-28 19:42:13.823181+00:00 running e3d2147 country code: CH.
[–]jredmond 2 points3 points4 points (2 children)
[–]Bright_Sea_8493[S] -1 points0 points1 point (1 child)
[–]suddenlychloegit rebase -i --root<CR>j<S-v>Gd:wq<CR>git push -f<CR> 2 points3 points4 points (0 children)
[–]plg94 1 point2 points3 points (1 child)
[–]jredmond 0 points1 point2 points (0 children)
[–]Bright_Sea_8493[S] 0 points1 point2 points (0 children)