您的位置:首页 > 编程语言

windows下使用git和github建立远程仓库

2017-10-21 22:41 459 查看


windows下使用gitgithub建立远程仓库

(查看附件)

 

(01)Generating a new SSH key

Open Git
Bash(rootpath:C:\Users\Administrator)

Paste the text below, substituting in your GitHub email address.

$ssh-keygen -t rsa -b 4096 -C "your_email@example.com"

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

 



Force connection: 

git push -f machine master

push to remote repertory for save name and password:

git config --global credential.helper "store"
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: