github 入门_Github入门-入门指南

github 入门

Github is one of the most widely used code repository storage system. It is helpful in storing content on a cloud network and manage it via Git. Moreover, you can also fork some other repository for your own usage, provided it is publicly available and license of that repository defines to what extent you can modify and use the forked codebase. To begin with, Github offers both private and public repositories. As a free user, you are allowed to have only public repositories. More details about the pricing can be found here.

Github是使用最广泛的代码存储库存储系统之一。 它有助于将内容存储在云网络上并通过Git对其进行管理。 此外,您还可以派生其他一些存储库以供自己使用,前提是该存储库是公开可用的,并且该存储库的许可证定义了可以在何种程度上修改和使用分支的代码库。 首先,Github提供私有和公共存储库。 作为免费用户,您只能拥有公共存储库。 有关定价的更多详细信息,请参见此处。

In this post, we are going to create a new repository using Github’s graphical interface and then clone it onto our system. After that, we will put some code locally and then push it to the online repository that we created.

在本文中,我们将使用Github的图形界面创建一个新的存储库,然后将其克隆到我们的系统中。 之后,我们将一些代码放在本地,然后将其推送到我们创建的在线存储库中。

Prerequisite – github account

先决条件– github帐户

Creating a repository

创建一个仓库

  • Login to your github account and look for a New repository button in the right side of homepage.
  • 登录到您的github帐户,并在主页右侧查找“ 新建存储库”按钮。

GitHub

  • In next step, give a name to your repository. We are using here name – ‘PyJournal’
  • Initialize the repository with a Readme so that we can let people what is the purpose of this respository.
  • Select visibility as public and click on Create repository
  • 在下一步中,为您的存储库命名。 我们在这里使用的名称-'PyJournal'
  • 使用自述文件初始化存储库,以便我们可以让人们知道此存储库的用途。
  • 选择公开的可见性,然后单击创建存储库

Cloning the repository

克隆存储库

  • To interact with our newly created repository, we need git to be installed in our local system. Download git depending upon type of your operating system.
  • After download and installation is successful, open git bash from start menu. A console will be opened.
  • In your console, navigate to the place where you want to store your repository locally.
  • To clone your repository, give command – git clone https://github.com/<your github usernmame>/<repository name>.git
  • If it prompts you for username and password for accessing your github account.
  • After cloning is successful, you will see a contents of your remote repository created earlier available locally.
  • 要与我们新创建的存储库进行交互,我们需要在本地系统中安装git。 根据您的操作系统类型下载git
  • 下载和安装成功后,从开始菜单打开git bash。 将打开一个控制台。
  • 在控制台中,导航到要在本地存储存储库的位置。
  • 要克隆您的存储库,请发出命令– git clone https://github.com/ <您的github用户名> / <存储库名称> .git
  • 如果提示您输入用于访问github帐户的用户名和密码。
  • 克隆成功后,您将看到本地创建的较早创建的远程存储库的内容。

Modifying the remote repository

修改远程存储库

  • Since we selected to create a readme file during repository creation, an empty readme file will be available in your local system.
  • Open readme using any text editor and put some information about your repository, save and close it.
  • After that go to git bash at the root of your repository.
  • type
    git add README.md
    
  • 由于我们选择在存储库创建期间创建自述文件,因此在您的本地系统中将有一个空的自述文件。
  • 使用任何文本编辑器打开自述文件,并放置一些有关您的存储库的信息,然后保存并关闭它。
  • 之后,转到存储库根目录下的git bash。
  • 类型
  •  Now readme file is staged to be committed to your local repository.
  • To commit, type
    git commit -m 'updated readme'
    
  • Now changes are committed in your local system. You need to push this changes to remote master branch of your repository. Type
  • If prompted for account credentials, provide it.
  • 现在,自述文件已暂存到本地存储库中。
  • 要提交,请键入
    git commit -m 'updated readme'
    
  • 现在,更改已提交到您的本地系统中。 您需要将此更改推送到存储库的远程主分支。 类型
  • 如果提示您提供帐户凭据,请提供它。

If everything goes fine, your changes will be successfully committed and pushed to the github remote repository. You can verify the same by going to your github repository and look for the changed readme file.

如果一切顺利,您的更改将成功提交并推送到github远程存储库。 您可以通过转到github存储库并查找更改的自述文件来验证相同的内容。

翻译自: https://www.pybloggers.com/2016/07/getting-started-with-github-a-beginners-guide/

github 入门

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值