34060

Git command - Repository heads not listed while using -h switch with “HEAD” option

Question:

There is a git repository in my LAN. I try to query Git to list all the HEAD references in the following way:

<strong>Method 1</strong>

<em>Command</em>

git ls-remote -h username@{ip-address}:/path/to/repo

<em>Output</em>

f0467f266dee55cd32f2ca6fa819814f367db899 HEAD

<strong>Method 2</strong>

<em>Command</em>

git ls-remote username@{ip-address}:/path/to/repo HEAD

<em>Output</em>

f0467f266dee55cd32f2ca6fa819814f367db899 HEAD

<strong>Method 3</strong>

<em>Command</em>

git ls-remote -h username@{ip-address}:/path/to/repo HEAD

When using the above command, the head reference which was listed in the above two methods is not listed.

Any idea on this?

Answer1:

I suspect this is because HEAD is a special kind of refs, it's not a head of a branch, it doesn't reside in refs/heads/ namespace. So when you ask git to list refs with both -h and HEAD git sees a contradiction and doesn't list any refs.

Recommend

  • Using Git filter-branch to rename author and committer of several branches including tags
  • Python code to find all newly created, modified and deleted files in all the directories/sub-directo
  • Modifying old commit in git
  • git rebase conflicts, how to delete all conflicting files that were deleted in the HEAD
  • DIRECT replacement of UserHostAddress in ASP.NET Core?
  • Send command to FTP server using sockets in C
  • How to use Google Places API for Web Service in android?
  • nginx, upstream, cors fail
  • Using remote host as working directory, git extensions
  • 'SOCK_RAW' option in 'socket' system call
  • Azure VM Scale Sets Internal Loadbalancer
  • LG WEBOS : Could not connect to the device, please check the device connection
  • Coherence clustering configuration
  • Combinatios in List of LIsts Prolog
  • os.system not working, but typing the same thing into the command prompt works
  • Specify source IP address for TCP socket when using Linux network device aliases
  • ManagementObjectSearcher select network printers?
  • Send http request through specific network interface
  • How to avoid using dynamic variables / a billion if statements in Java?
  • Google cloud datastore emulator init data
  • Can you render a page with multiple forms instead of one form for a jQuery, Rails 3 update?
  • Gerrit will not push. Error: No common ancestry
  • Google OAuth2 for an web application hosted behind NAT (intranet server without public IP)
  • Showing spinner for Rails 3 UJS gets Type error
  • How to resolve docker host names (/etc/hosts) in containers
  • Can my app be notified when another application starts/stops playing audio?
  • Should I be afraid to use UDP to make a client/server broadcast talk?
  • OSX - always hide certain files
  • Tomcat memory Leak
  • Stop Bash Script if Hive Fails
  • MongoError: Incorrect arguments
  • Django rest serializer Breaks when data exists
  • Cannot resolve symbol 'MyApi'
  • SignalR .NET Client Invoke throws an exception
  • Azure Cloud Service Web Role web pages do not load
  • How to redirect a user to a different server and include HTTP basic authentication credentials?
  • using conditional logic : check if record exists; if it does, update it, if not, create it
  • Codeigniter doesn't let me update entry, because some fields must be unique
  • Getting error when using KSoap library to consume .NET web services
  • coudnt use logback because of log4j