Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
rb:git-cheatsheet [12/09/2018 17:01]
andrew [git remote add]
rb:git-cheatsheet [19/09/2018 16:33] (current)
andrew [git push]
Line 53: Line 53:
 ==== git remote add ==== ==== git remote add ====
  
-Adds a remote named <​name>​ for the repository at <​url>​. ​+Adds a remote named <​name>​ for the repository at <url>.  Convention seems to be using ''​origin'',​ but you could use a more descriptive name.
  
 ''​git remote add [-t <​branch>​] [-m <​master>​] [-f] [--[no-]tags] [--mirror=<​fetch|push>​] <​name>​ <​url>''​ ''​git remote add [-t <​branch>​] [-m <​master>​] [-f] [--[no-]tags] [--mirror=<​fetch|push>​] <​name>​ <​url>''​
  
   $ git remote add origin https://​github.com/​user/​CIS-Hardening-AWS_Linux2.git   $ git remote add origin https://​github.com/​user/​CIS-Hardening-AWS_Linux2.git
 +  or
 +  $ git remote add codeCommit https://​git-codecommit.eu-west-1.amazonaws.com/​v1/​repos/​CIS-Hardening-AWS_Linux2
  
  
 +==== git remote delete ====
 +
 +Deletes a remote URL
 +
 +  $ git remote rm CodeCommit
 +
 +
 +==== Verify remote URL ====
 +
 +
 +  $ git remote -v
 ==== git push ==== ==== git push ====
  
Line 79: Line 92:
  
   $ git config --global credential.helper cache   $ git config --global credential.helper cache
 +
 +
 +If this doesn'​t work it may fail with a message:​- ​
 +  error: src refspec master does not match any.
 +  error: failed to push some refs to '​origin'​
 +
 +The reason for this is that there is only a local master branch created when commits have been done, so create or touch a file, add it and then repush to remote.
 +
  
 ==== git status ==== ==== git status ====
Line 288: Line 309:
   $ git checkout 3d83c24b89d7b27aecf99fecef54982d3ecf0620^ -- ansible_id_rsa ​   $ git checkout 3d83c24b89d7b27aecf99fecef54982d3ecf0620^ -- ansible_id_rsa ​
  
 +
 +
 +====== AWS CodeCommit ======
 +
 +
 +<​code>​
 +$ aws codecommit create-repository --repository-name CIS-Hardening-AWS_Linux2 --repository-description "Repo for ansible code to harden aws Linux2 image."​
 +{
 +    "​repositoryMetadata":​ {
 +        "​repositoryDescription":​ "Repo for ansible code to harden aws Linux2 image.",​
 +        "​cloneUrlSsh":​ "​ssh://​git-codecommit.eu-west-2.amazonaws.com/​v1/​repos/​CIS-Hardening-AWS_Linux2",​
 +        "​repositoryId":​ "​91fb59e3-833e-4705-8e1c-xxxxx",​
 +        "​lastModifiedDate":​ 1537199788.236,​
 +        "​accountId":​ "​1234567789",​
 +        "​repositoryName":​ "​CIS-Hardening-AWS_Linux2",​
 +        "​Arn":​ "​arn:​aws:​codecommit:​eu-west-2:​581230658448:​CIS-Hardening-AWS_Linux2",​
 +        "​cloneUrlHttp":​ "​https://​git-codecommit.eu-west-2.amazonaws.com/​v1/​repos/​CIS-Hardening-AWS_Linux2",​
 +        "​creationDate":​ 1537199788.236
 +    }
 +}
 +</​code>​
  

rb/git-cheatsheet.1536768078.txt.gz ยท Last modified: 12/09/2018 17:01 by andrew