Git repository initialize

Limited personal capacity, for any errors please correct me criticism!

Reproduced, please indicate the source: http: //www.cnblogs.com/wenhust/

 

Why should upload an SSH public key?

After your clients have access to git git repository hosting sites via SSH protocol to upload your SSH public keys to the local git repository hosting sites, each execution git push / fetch automatically use SSH key authentication to access a remote SSH Keys misallocation code base error.

How to generate SSH public key and upload?

  1. In Mac OS or Linux terminal or Windows Git Bash, execute ssh-keygen command generates SSH public and private keys
ssh-keygen -t rsa

Fill SSH key storage directory, or directly enter exist in the default location:

$HOME/.ssh/

Enter SSH keys using a password and remember, will use this password each time you download and upload; or directly enter the password is not set

  1. View and copy the SSH public key
cat ~/.ssh/id_rsa.pub
  1. Paste to fill in the box, add save it

 

Command line instructions

Git global setup

git config --global user.name "Your Name"
git config --global user.email ""[email protected]"" 

Create a new repository

git clone ssh://xxx.git
cd YourProj
touch README.md
git add README.md
git commit -m "add README"
git push -u origin master

Existing folder

cd existing_folder
git init
git remote add origin ssh://xxx.git git add . git commit -m "Initial commit" git push -u origin master 

Existing Git repository

cd existing_repo
git remote add origin ssh://xxx.git
git push -u origin --all
git push -u origin --tags

Guess you like

Origin www.cnblogs.com/wenhust/p/12421557.html