Questions tagged [refspec]
25 questions
60
votes
2 answers
Git error: src refspec master does not match any error: failed to push some refs
I am trying to add a file to my repository on BitBucket and I am having trouble.
I am using GIT and this is what I type in
$ cd lis4368/assignments
$ git remote
$ git remote -v
$ git remote rm origin
and then I type this in (this is what BitBucket…

user1676428
- 671
- 1
- 7
- 13
24
votes
2 answers
git pull origin master returns fatal: invalid refspec
Here is the problem:
Whenever I do
$ git pull 'https://github.com/username/reponame.github.io.git'
followed by the url I get no problems but when I do
git pull origin master 'https://github.com/username/reponame.github.io.git'
followed by the url…

smotchysmooly
- 343
- 1
- 2
- 7
18
votes
4 answers
How to configure specific upstream push refspec for Git when used with Gerrit?
I'm setting up Git with Gerrit Code Review and am looking for a way to make the necessary Git commands relatively straightforward for users who might be new to Git.
The commands I currently have for starting a new feature branch are essentially…

Greg Hewgill
- 951,095
- 183
- 1,149
- 1,285
12
votes
3 answers
Obtain the latest refspec on a Gerrit Change
How can I obtain the latest refspec on a gerrit change through a single command.
I need the output as "refs/changes/11/1234/4". Is there any git command for the same
I do know that ssh commands combined with gerrit query and a bit of scripting can…

Jose
- 1,333
- 5
- 20
- 38
9
votes
3 answers
Git push command, error encountered -fatal: invalid refspec 'https://github.......git'
I'm in the master branch and have added the remote branch, after which I'm unable to push the data from local to remote.:
$ Git remote add master https://....git
$ Git push origin master https:// ...git
Fatal: invalid refspec 'https://...git'

melony_r
- 177
- 1
- 1
- 8
9
votes
2 answers
src refspec ~ does not match any
Hi I want to push something to specific remote branch
I make local areas by
git clone https://~~~.Something
cd https://~~~.Something
and I can access specific branch using
git checkout origin/[branch]
I want to commit something to my specific…

kwony
- 109
- 1
- 1
- 5
6
votes
1 answer
Merging multiple Git repositories with tags
I am working with a number of different Git repos that will need to be merged together. The workflow would look like this:
git remote add fork1 ...
git remote add fork2 ...
git fetch fork1
git fetch fork2
git merge fork1/master fork2/master
This is…

jfmatt
- 926
- 5
- 14
5
votes
1 answer
Is there a git command that can resolve an error: remote branch 'refs/heads/foo/bar' not found?
In my situation I was tracking a remote hotfix branch which someone else merged and removed.
I have deleted my local branch but when I pull I still get the above error because I have the following lines in my git config file:
[remote "origin"]
...
…

Naylor
- 752
- 7
- 20
5
votes
2 answers
"git push" to Gerrit with a tracking branch
Pushing changes to Gerrit requires the rather esoteric command
git push origin HEAD:refs/for/branchname
We've scripted this, but I'm looking for a way to do this natively. With git's powerful config, it looks like I can preconfigure most of it[1] so…

John de Largentaye
- 893
- 4
- 19
4
votes
1 answer
Git checkout remote branch of a remote repository
When git clone some repository then it retrieves all branches from it:
git clone https://github.com/android/platform_build.git build1
cd build1/ && git branch -a && cd ..
then, when I use build1 as a mirror and clone it, I do not see all its remote…

duleorlovic
- 432
- 4
- 15
3
votes
1 answer
Git track different branches for push and pull?
I have a Git repository which is being managed with Gerrit, where you don't push to , but instead push to refs/for/, and then magic happens. Thus, I'd like different behavior for git pull and git push. In particular, I want git pull…

joshlf
- 21,822
- 11
- 69
- 96
3
votes
1 answer
Git push with full refspec not working
I have 2 branches (both locally and remotely on github). I will call them BranchA and BranchB.
I have BranchA with commits c1, c2 and c3.
I have BranchB only with commit c1.
Both branches are totally updated with github, and I can check that BranchA…

phansh
- 33
- 4
3
votes
2 answers
git push new file to a bare repo failed: "error: src refspec master does not match any." Why?
I was trying this:
mkdir ~/gitremote
cd ~/gitremote
git init --bare
I can see file names like
HEAD config hooks objects
branches description info refs
OK, then in another directory,
git clone…

Troskyvs
- 7,537
- 7
- 47
- 115
2
votes
1 answer
How to add submodule correctly with non-standart refspec?
We are using Gerrit for code review.
Gerrit stores reviewed code in non-standard reference path - refs/changes.
So, reference to commit looks like refs/changes/95/295/2 .
I want to add project from Gerrit to my superproject as a submodule.
I can do…

Ivan Tolstosheyev
- 111
- 9
1
vote
0 answers
Is it possible to clone a submodule in git without getting its master branch?
Say that I have a repo A, that has a submodule B. B has a branch X that A is interested in. Is it possible to clone A, and then get branch X for B, without also pulling down B's master. I tried having .gitmodule specify branch X for B, "git…

Frank An
- 11
- 1