Difference between revisions of "Git clone"

From wikieduonline
Jump to navigation Jump to search
 
(31 intermediate revisions by 3 users not shown)
Line 1: Line 1:
 
{{lowercase}}
 
{{lowercase}}
 
<code>[[git]] clone</code>
 
<code>[[git]] clone</code>
* Documentation: https://git-scm.com/docs/git-clone
+
* Doc: https://git-scm.com/docs/git-clone
  
[[git clone -vv]] https://github.com/zabbix/zabbix-docker.git
+
* [[git clone --help]]
Cloning into 'zabbix-docker'...
+
      git-clone - Clone a repository into a new directory
  
  git clone ssh://[email protected]:2224/username/test.git
+
  SYNOPSIS
Cloning into 'test'...
+
      git clone [--template=<template-directory>]
warning: You appear to have cloned an empty repository.
+
                [-l] [-s] [--no-hardlinks] [-q] [-n] [--bare] [--mirror]
 +
                [-o <name>] [-b <name>] [-u <upload-pack>] [--reference <repository>]
 +
                [--dissociate] [--separate-git-dir <git-dir>]
 +
                [--depth <depth>] [--[no-]single-branch] [--no-tags]
 +
                [--recurse-submodules[=<pathspec>]] [--[no-]shallow-submodules]
 +
                [--[no-]remote-submodules] [--jobs <n>] [--sparse] [--[no-]reject-shallow]
 +
                [--filter=<filter> [--also-filter-submodules]] [--] <repository>
 +
                [<directory>]
 +
 
 +
== Examples ==
 +
* <code>[[git clone]] https://github.com/zabbix/zabbix-docker.git</code>
 +
* <code>[[git clone]] https://github.com/zabbix/zabbix-docker.git name_folder_to_clone</code>
 +
* <code>[[git clone -vv]] https://github.com/zabbix/zabbix-docker.git</code>
 +
* <code>git clone ssh://[email protected]:2224/username/test.git</code>
  
 
* <code>git clone [[--depth]]=1 https://gerrit.wikimedia.org/r/mediawiki/core.git mediawiki</code>
 
* <code>git clone [[--depth]]=1 https://gerrit.wikimedia.org/r/mediawiki/core.git mediawiki</code>
 +
* <code>[[GIT_TRACE=1 GIT_CURL_VERBOSE=1 git clone --verbose]] https://github.com/zabbix/zabbix-docker.git</code>
 +
* <code>[[git clone -c]] http.[[sslVerify]]=false</code>
 +
** <code>[[--config]]</code>
 +
* <code>[[git clone --bare]]</code>
  
* <code>[[GIT_TRACE]]=1 [[GIT_CURL_VERBOSE]]=1 [[git clone --verbose]] https://github.com/zabbix/zabbix-docker.git</code>
 
  
* <code>git clone -c http.[[sslVerify]]=false</code>
+
for repo in $([[curl -s --header]] "[[PRIVATE-TOKEN]]: your_private_token" https://<your-host>/api/v4/groups/<group_id> | jq -r ".projects[].ssh_url_to_repo"); do git clone $repo; done;
  
* <code>[[git clone --bare]]</code>  
+
== Errors executing <code>[[git clone]]</code> ==
  
== Errors executing <code>[[git clone]]</code> ==
+
=== [[Permission denied]] ===
 
  [[git clone]] ssh://[email protected]:2224/username/test-username.git
 
  [[git clone]] ssh://[email protected]:2224/username/test-username.git
 
  Cloning into 'test-username'...
 
  Cloning into 'test-username'...
Line 25: Line 41:
 
  Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
 
  Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
 
  Warning: Permanently added '[10.10.10.5]:2224' (ECDSA) to the list of known hosts.
 
  Warning: Permanently added '[10.10.10.5]:2224' (ECDSA) to the list of known hosts.
  [email protected]: Permission denied (publickey).
+
  [email protected]: '''[[Permission denied]]''' (publickey).
 
  fatal: Could not read from remote repository.
 
  fatal: Could not read from remote repository.
 
   
 
   
  Please make sure you have the correct access rights
+
  [[Please make sure you have the correct access rights and the repository exists]].
and the repository exists.
 
  
 +
=== [[You appear to have cloned an empty repository]] ===
 +
Cloning into 'test'...
 +
warning: You appear to have cloned an empty repository.
  
 +
=== [[fatal: protocol error]]: bad pack header ===
 
  error: git upload-pack: git-pack-objects died with error.
 
  error: git upload-pack: git-pack-objects died with error.
 
  fatal: [[git upload-pack]]: aborting due to possible repository corruption on the remote side.
 
  fatal: [[git upload-pack]]: aborting due to possible repository corruption on the remote side.
 
  remote: aborting due to possible repository corruption on the remote side.
 
  remote: aborting due to possible repository corruption on the remote side.
 
  fatal: protocol error: bad pack header
 
  fatal: protocol error: bad pack header
  Solution: review memory usage on git server
+
 +
  Solution: Review [[memory]] usage on git server
  
  
  GIT_TRACE=1 GIT_CURL_VERBOSE=1 git clone --verbose https://gitlab.youdomain.com/project1/app.git
+
=== [[remote: Repository not found.]] ===
 +
 
 +
=== git clone -c http.sslVerify=false ===
 +
 
 +
  [[GIT_TRACE]]=1 [[GIT_CURL_VERBOSE]]=1 git clone --verbose https://gitlab.youdomain.com/project1/app.git
 
  15:31:11.872513 exec-cmd.c:139          trace: resolved executable path from Darwin stack:  
 
  15:31:11.872513 exec-cmd.c:139          trace: resolved executable path from Darwin stack:  
  /Library/Developer/CommandLineTools/usr/bin/git
+
  [[/Library/Developer/CommandLineTools/]]usr/bin/git
 
  15:31:11.873411 exec-cmd.c:236          trace: resolved executable dir: /Library/Developer/CommandLineTools/usr/bin
 
  15:31:11.873411 exec-cmd.c:236          trace: resolved executable dir: /Library/Developer/CommandLineTools/usr/bin
 
  15:31:11.873488 git.c:418              trace: built-in: git clone --verbose https://gitlab.youdomain.com/project1/app.git
 
  15:31:11.873488 git.c:418              trace: built-in: git clone --verbose https://gitlab.youdomain.com/project1/app.git
Line 62: Line 86:
 
  * stopped the pause stream!
 
  * stopped the pause stream!
 
  * Closing connection 0
 
  * Closing connection 0
  fatal: unable to access 'https://gitlab.youdomain.com/project1/app.git/': '''SSL certificate problem: [[self signed certificate]]'''
+
  [[fatal: unable to access]] 'https://gitlab.youdomain.com/project1/app.git/': '''SSL certificate problem: [[self signed certificate]]'''
  
 
  Use: git clone -c http.sslVerify=false
 
  Use: git clone -c http.sslVerify=false
 +
 +
=== Missing [[xcrun]] ===
 +
git clone
 +
[[xcrun]]: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at:
 +
/Library/Developer/CommandLineTools/usr/bin/xcrun
  
 
== Related terms ==
 
== Related terms ==
Line 72: Line 101:
 
* <code>[[git add]]</code>
 
* <code>[[git add]]</code>
 
* <code>[[git checkout]]</code>
 
* <code>[[git checkout]]</code>
 +
* [[Personal access token (PAT)]]
 +
* <code>[[gh repo clone]]</code>
 +
* Windows: <code>[[%HOMEDRIVE%%HOMEPATH%\.ssh\id_rsa.pub]]</code>
 +
* [[Remote: Support for password authentication was removed on]]
 +
* [[Octopus Service]]
  
 
== See also ==
 
== See also ==
* {{git}}
+
* {{git clone}}
  
 
[[Category:Git]]
 
[[Category:Git]]

Latest revision as of 12:43, 22 October 2024

git clone

      git-clone - Clone a repository into a new directory
SYNOPSIS
      git clone [--template=<template-directory>]
                [-l] [-s] [--no-hardlinks] [-q] [-n] [--bare] [--mirror]
                [-o <name>] [-b <name>] [-u <upload-pack>] [--reference <repository>]
                [--dissociate] [--separate-git-dir <git-dir>]
                [--depth <depth>] [--[no-]single-branch] [--no-tags]
                [--recurse-submodules[=<pathspec>]] [--[no-]shallow-submodules]
                [--[no-]remote-submodules] [--jobs <n>] [--sparse] [--[no-]reject-shallow]
                [--filter=<filter> [--also-filter-submodules]] [--] <repository>
                [<directory>]

Examples[edit]


for repo in $(curl -s --header "PRIVATE-TOKEN: your_private_token" https://<your-host>/api/v4/groups/<group_id> | jq -r ".projects[].ssh_url_to_repo"); do git clone $repo; done;

Errors executing git clone[edit]

Permission denied[edit]

git clone ssh://[email protected]:2224/username/test-username.git
Cloning into 'test-username'...
The authenticity of host '[10.10.10.5]:2224 ([10.10.10.5]:2224)' can't be established.
ECDSA key fingerprint is SHA256:WMfMtq7QBOrI/388RFgiWv8FJwV36qFrOtjvXJ7RZY4.
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added '[10.10.10.5]:2224' (ECDSA) to the list of known hosts.
[email protected]: Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights and the repository exists.

You appear to have cloned an empty repository[edit]

Cloning into 'test'...
warning: You appear to have cloned an empty repository.

fatal: protocol error: bad pack header[edit]

error: git upload-pack: git-pack-objects died with error.
fatal: git upload-pack: aborting due to possible repository corruption on the remote side.
remote: aborting due to possible repository corruption on the remote side.
fatal: protocol error: bad pack header

Solution: Review memory usage on git server


remote: Repository not found.[edit]

git clone -c http.sslVerify=false[edit]

GIT_TRACE=1 GIT_CURL_VERBOSE=1 git clone --verbose https://gitlab.youdomain.com/project1/app.git
15:31:11.872513 exec-cmd.c:139          trace: resolved executable path from Darwin stack: 
/Library/Developer/CommandLineTools/usr/bin/git
15:31:11.873411 exec-cmd.c:236          trace: resolved executable dir: /Library/Developer/CommandLineTools/usr/bin
15:31:11.873488 git.c:418               trace: built-in: git clone --verbose https://gitlab.youdomain.com/project1/app.git
Cloning into 'app'...
15:31:11.896610 run-command.c:643       trace: run_command: git-remote-https origin 
https://gitlab.youdomain.com/project1/app.git
15:31:11.909999 exec-cmd.c:139          trace: resolved executable path from Darwin stack: 
/Library/Developer/CommandLineTools/usr/libexec/git-core/git-remote-https
15:31:11.911055 exec-cmd.c:236          trace: resolved executable dir: /Library/Developer/CommandLineTools/usr/libexec/git-core
* Couldn't find host gitlab.youdomain.com in the .netrc file; using defaults
*   Trying 10.10.110.xx...
* TCP_NODELAY set
* Connected to gitlab.youdomain.com (10.10.xx.xx) port 443 (#0)
* ALPN, offering http/1.1
* Cipher selection: ALL:!EXPORT:!EXPORT40:!EXPORT56:!aNULL:!LOW:!RC4:@STRENGTH
* successfully set certificate verify locations:
*   CAfile: /etc/ssl/cert.pem
  CApath: none
* SSL certificate problem: self signed certificate
* stopped the pause stream!
* Closing connection 0
fatal: unable to access 'https://gitlab.youdomain.com/project1/app.git/': SSL certificate problem: self signed certificate
Use: git clone -c http.sslVerify=false

Missing xcrun[edit]

git clone
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: 
/Library/Developer/CommandLineTools/usr/bin/xcrun

Related terms[edit]

See also[edit]

Advertising: