windows下使用git和github建立远程仓库
windows下使用git和github建立远程仓库
(查看附件)
(01)Generating a new SSH key
Open Git Bash(rootpath:C:\Users\Administrator)
Paste the text below, substituting in your GitHub email address.
$ssh-****** -t rsa -b 4096 -C "[email protected]"
This creates a new ssh key, using the provided email as a label.
Generating public/private rsa key pair.
When you're prompted to "Enter a file in which to save the key," press Enter. This accepts the default file location.
Enter a file in which to save the key (/c/Users/you/.ssh/id_rsa):[Press enter]
At the prompt, type a secure passphrase. For more information, see "Working with SSH key passphrases".
Enter passphrase (empty for no passphrase): [Type a passphrase]
Enter same passphrase again: [Type passphrase again]
(02)Generating a new SSH key
Adding your SSH key to the ssh-agent
Before adding a new SSH key to the ssh-agent to manage your keys, you should have checked for existing SSH keys and generated a new SSH key.
If you have GitHub Desktop installed, you can use it to clone repositories and not deal with SSH keys. It also comes with the Git Bash tool, which is the preferred way of running git commands on Windows.
Ensure the ssh-agent is running:
- If you are using the Git Shell that's installed with GitHub Desktop, the ssh-agent should be running.
- If you are using another terminal prompt, such as Git for Windows, you can use the "Auto-launching the ssh-agent" instructions in "Working with SSH key passphrases", or start it manually:
# start the ssh-agent in the background
$eval $(ssh-agent -s)
Agent pid 59566
.
Add your SSH private key to the ssh-agent. If you created your key with a different name, or if you are adding an existing key that has a different name, replace id_rsa in the command with the name of your private key file.
$ssh-add ~/.ssh/id_rsa
.
(03)Add the SSH key to your GitHub account
(04)Create remote GitHub project
(05)Create locak repertory(The name need same with remote repertory )
(05)Configure account
(05)Conneation local repertoy to remote repertory
git push -f machine master
push to remote repertory for save name and password:
git config --global credential.helper "store"