To upload your own local repository to Github

This paper describes GitHub installation registration, as well as some git commands, the most important is how to upload your own warehouse on GitHub, refer to the following two articles, these two articles is suitable for beginners, but this my personal my that may be more elaborate, as encountered in the process of doing follow in a few small problems to solve on their own Baidu, this article also encountered problems and solutions do provide screenshots explanation, and I hope to help as You learn ~

Thanks to the original
GitHub remote repository
GitHub simple tutorial

1. What is Github?

github git code is based on a hosted platform, subscribers can build a private warehouse, we generally free users can only use a public warehouse, which is the code to open

Github founded by Chris Wanstrath, PJ Hyett and Tom Preston-Werner three developers in April 2008

2. Register an account and create a warehouse

To use github first step of course is a registered github account, github official website address: https://github.com/. Then you can create a simple tutorial warehouse (free users can only build a public warehouse), Create a New Repository, fill it out name Create, then there will be a number of warehouse configuration information, which is of a git.

3.Github installation

Installation address

Git can be configured after installing the. Sometimes your computer obviously installed, but forget forget installed where the (my routine. Embarrassing ..) So how do you know you did not install git on computer security? We can look at this How do I know if a computer is installed Git

4. Configuration Git

First, create a ssh key locally;

$ ssh-keygen -t rsa -C "[email protected]"

    
    
  • 1

Back [email protected] changed your mailbox registered on github, then you will be asked to confirm the path and enter the password 123456, here I use the default way to enter the line. Successful will generate .ssh folder ~ / down, go in, open id_rsa.pub, copy inside the key.
Here Insert Picture Description
You can use the command open ~ / .ssh find id_rsa.pub file
Here Insert Picture Description
to open the copy inside the key

Back on github, enter Account Settings (account configuration)
Here Insert Picture Description
on the left select SSH and GPG keys, and then click New SSH key buttons, title set title, can easily fill, paste in your generated on a computer key (note that copy the whole oh )
Here Insert Picture Description

After confirmation will let you enter a password, enter the password to your GitHub account

Here Insert Picture Description

Once added is shown as follows
Here Insert Picture Description

To verify successful, enter the following command:

ssh -T [email protected]

    
    
  • 1

Hi tianqixin! You've successfully authenticated, but GitHub does not provide shell access.
Indicating that it has successfully connected on Github! Happy

After login and click "New repository" as shown below:
Here Insert Picture Description

After the Repository name filled runoob-git-test (remote repository name), others keep the default settings, click on "Create repository" button, you successfully created a new Git repository:

Here Insert Picture Description
Once created, the following message appears:
Here Insert Picture Description

The above information tells us that this repository can be cloned from a new warehouse, it can also be pushed to the contents of the local repository GitHub repository.

Now, we run command in the local repository GitHub of the prompts:
# Create a test directory

mkdir runoob-git-test

    
    
  • 1

# Into the test directory

cd runoob-git-test/

    
    
  • 1

# Create README.md file and write the contents of

echo "git 测试" >> README.md 

    
    
  • 1

View files in the directory #

ls

    
    
  • 1

The README
# initialize

git init

    
    
  • 1

#add files

git add README.md

    
    
  • 1

Here Insert Picture Description
After executing a change in the most intuitive that you can see runoob-git-test folder you created in the directory, file and README.md
Here Insert Picture Description
# submit information and notes

git commit -m "添加 README.md 文件"

    
    
  • 1

Here Insert Picture Description
# Submit to Github

git remote add origin https://github.com/luckyduo/HelloWorld.git
git push -u origin master

    
    
  • 1
  • 2

The following command Depending on where you successfully create a new warehouse in Github copy, rather than ordered me to provide, because our Github username is not the same, the repository name is not the same.
Here Insert Picture Description
Will let you enter the username and password
username is your GitHub account and password for me. Daily forget your password. . Lost several times before entering the correct
Here Insert Picture Description
then we return to the warehouse Github create, refresh, you can see the files have been uploaded to Github
Here Insert Picture Description
completed, the next step is learning how to use GitHub (≧ ▽ ≦) / la la la, please poke down a ☞ GitHub tutorial

Published 25 original articles · won praise 1 · views 759

This paper describes GitHub installation registration, as well as some git commands, the most important is how to upload your own warehouse on GitHub, refer to the following two articles, these two articles is suitable for beginners, but this my personal my that may be more elaborate, as encountered in the process of doing follow in a few small problems to solve on their own Baidu, this article also encountered problems and solutions do provide screenshots explanation, and I hope to help as You learn ~

Thanks to the original
GitHub remote repository
GitHub simple tutorial

1. What is Github?

github是一个基于git的代码托管平台,付费用户可以建私人仓库,我们一般的免费用户只能使用公共仓库,也就是代码要公开

Github 由Chris Wanstrath, PJ Hyett 与Tom Preston-Werner三位开发者在2008年4月创办

2.注册账户以及创建仓库

要想使用github第一步当然是注册github账号了, github官网地址:https://github.com/。 之后就可以创建仓库了(免费用户只能建公共仓库),Create a New Repository,填好名称后Create,之后会出现一些仓库的配置信息,这也是一个git的简单教程。

3.Github 安装

安装的地址

安装好后就可以配置Git了。有时候自己电脑明明装了,但是忘记了也忘记安装在哪了(我的日常。尴尬。。)所以如何知道你电脑上安没安装git?可以看一下这篇如何知道自己电脑是否安装了Git

4.配置Git

首先在本地创建ssh key;

$ ssh-keygen -t rsa -C "[email protected]"

  
  
  • 1

后面的[email protected]改为你在github上注册的邮箱,之后会要求确认路径和输入密码123456,我这里使用默认的一路回车就行。成功的话会在~/下生成.ssh文件夹,进去,打开id_rsa.pub,复制里面的key。
Here Insert Picture Description
可使用命令open ~/.ssh找到id_rsa.pub文件
Here Insert Picture Description
打开复制里面的key

回到github上,进入 Account Settings(账户配置)
Here Insert Picture Description
左边选择 SSH and GPG keys,然后点击 New SSH key 按钮,title 设置标题,可以随便填,粘贴在你电脑上生成的 key(注意复制的是整段哦)
Here Insert Picture Description

之后会让你输入确认密码,把你的GitHub账号的密码输入即可

Here Insert Picture Description

添加成功后界面如下所示
Here Insert Picture Description

To verify successful, enter the following command:

ssh -T [email protected]

  
  
  • 1

Hi tianqixin! You've successfully authenticated, but GitHub does not provide shell access.
Indicating that it has successfully connected on Github! Happy

After login and click "New repository" as shown below:
Here Insert Picture Description

After the Repository name filled runoob-git-test (remote repository name), others keep the default settings, click on "Create repository" button, you successfully created a new Git repository:

Here Insert Picture Description
Once created, the following message appears:
Here Insert Picture Description

The above information tells us that this repository can be cloned from a new warehouse, it can also be pushed to the contents of the local repository GitHub repository.

Now, we run command in the local repository GitHub of the prompts:
# Create a test directory

mkdir runoob-git-test

  
  
  • 1

# Into the test directory

cd runoob-git-test/

  
  
  • 1

# Create README.md file and write the contents of

echo "git 测试" >> README.md 

  
  
  • 1

View files in the directory #

ls

  
  
  • 1

The README
# initialize

git init

  
  
  • 1

#add files

git add README.md

  
  
  • 1

Here Insert Picture Description
After executing a change in the most intuitive that you can see runoob-git-test folder you created in the directory, file and README.md
Here Insert Picture Description
# submit information and notes

git commit -m "添加 README.md 文件"

  
  
  • 1

Here Insert Picture Description
# Submit to Github

git remote add origin https://github.com/luckyduo/HelloWorld.git
git push -u origin master

  
  
  • 1
  • 2

The following command Depending on where you successfully create a new warehouse in Github copy, rather than ordered me to provide, because our Github username is not the same, the repository name is not the same.
Here Insert Picture Description
Will let you enter the username and password
username is your GitHub account and password for me. Daily forget your password. . Lost several times before entering the correct
Here Insert Picture Description
then we return to the warehouse Github create, refresh, you can see the files have been uploaded to Github
Here Insert Picture Description
completed, the next step is learning how to use GitHub (≧ ▽ ≦) / la la la, please poke down a ☞ GitHub tutorial

Guess you like

Origin blog.csdn.net/qq_42770949/article/details/104975753
Recommended