github 设置
来源:互联网 发布:朗威数字化实验室 淘宝 编辑:程序博客网 时间:2024/06/04 19:46
Set Up Git
If you've found yourself on this page, we're assuming you're brand new to Git and GitHub. This guide will walk you through the basics and explain a little bit about how everything works along the way.
Download and Install Git
At the heart of GitHub is an open source version control system (VCS) called Git*. Created by the same dudes that created Linux, Git is responsible for everything GitHub related that happens locally on your computer.
*If you don't already know what Git is, take a crash course.
Download and install the latest version of Git.
Good to know: Git won't add an icon anywhere, it's not that sort of application.
Set Up Git
Now that you have Git installed, it's time to configure your settings. To do this you need to open an app called Terminal.
Need a quick lesson aboutTerminal?
Username
First you need to tell git your name, so that it can properly label the commits you make.
git config --global user.name "Your Name Here"# Sets the default name for git to use when you commit
Git saves your email address into the commits you make. We use the email address to associate your commits with your GitHub account.
git config --global user.email "your_email@youremail.com"# Sets the default email for git to use when you commit
Your email address for Git should be the same one associated with your GitHub account. If it is not, seethis guide for help adding additional emails to your GitHub account. If you want to keep your email address hidden,this guide may be useful to you.
Overriding settings in individual repos
Password caching
The last option we need to set will tell git that you don't want to type your username and password every time you talk to a remote server.
Good to know: You need git 1.7.10 or newer to use the credential helper
To use this option, you need to turn on the credential helper so that git will save your password in memory for some time:
git config --global credential.helper cache# Set git to use the credential memory cache
By default git will cache your password for 15 minutes. You can change this if you like.
git config --global credential.helper 'cache --timeout=3600'# Set the cache to timeout after 1 hour (setting is in seconds)
Good to know: The credential helper only works when you clone an HTTPS repo URL. If you use the SSH repo URL instead, SSH keys are used for authentication.This guide offers help generating and using an SSH key pair.
Celebrate
Congratulations, you now have Git and GitHub all set up! What do you want to do next?
Creating a new repository
You can create a new repository on your personal account or any organization account where you have sufficient permissions.
- In your user bar at the top right of any page, click the"Create a New Repo" button
- Select the account you wish to create the repo on
- Enter a name, select to make the repo either public or private and click "Create repository"
Good to know: If you do not have Owner or Admin rights in the organization it will say "insufficient permission" in the list.
Fork A Repo
If you've found yourself on this page, we're assuming you're brand new to Git and GitHub. This guide will walk you through the basics and explain a little bit about how everything works along the way.
Contributing to a project
At some point you may find yourself wanting to contribute to someone else's project, or would like to use someone's project as the starting point for your own. This is known as "forking." For this tutorial, we'll be using theSpoon-Knife project.
Step 1: Fork the "Spoon-Knife" repo
To fork this project, click the "Fork" button.
Step 2: Clone your fork
You've successfully forked the Spoon-Knife repo, but so far it only exists on GitHub. To be able to work on the project, you will need to clone it to your local machine.
Run the following code:
git clone https://github.com/username/Spoon-Knife.git# Clones your fork of the repo into the current directory in terminal
Step 3: Configure remotes
When a repo is cloned, it has a default remote called origin
that points to your fork on GitHub, not the original repo it was forked from. To keep track of the original repo, you need to add another remote namedupstream
:
More about remotes
cd Spoon-Knife# Changes the active directory in the prompt to the newly cloned "Spoon-Knife" directorygit remote add upstream https://github.com/octocat/Spoon-Knife.git# Assigns the original repo to a remote called "upstream"git fetch upstream# Pulls in changes not present in your local repository, without modifying your files
More Things You Can Do
You've successfully forked a repo, but get a load of these other cool things you can do:
Push commits
Once you've made some commits to a forked repo and want to push it to your forked project, you do it the same way you would with a regular repo:
More about commits
git push origin master# Pushes commits to your remote repo stored on GitHub
Pull in upstream changes
If the original repo you forked your project from gets updated, you can add those updates to your fork by running the following code:
git fetch upstream# Fetches any new changes from the original repogit merge upstream/master# Merges any changes fetched into your working files
What is the difference between fetch and pull?
Create branches
Branching allows you to build new features or test out ideas without putting your main project at risk. In git, branch is a sort of bookmark that references the last commit made in the branch. This makes branches very small and easy to work with.
How do I use branches?
Pull requests
If you are hoping to contribute back to the original fork, you can send the original author apull request.
Unwatch the main repo
When you fork a particularly popular repo, you may find yourself with a lot of unwanted updates about it. To unsubscribe from updates to the main repo, click the "Unwatch" button on themain repo.
Delete your fork
At some point you may decide that you want to delete your fork. To delete a fork, just follow the same steps as you would todelete a regular repo.
Celebrate
You have now forked a repo. What do you want to do next?
- github 设置
- ubuntu github设置
- github设置ssh
- github 公钥 设置
- github设置添加SSH
- github设置添加SSH
- github ssh 设置
- github设置添加SSH
- github 设置SSH
- github设置添加SSH
- github设置添加SSH
- Github效果图预览设置
- github设置添加ssh
- ubuntu github设置
- github设置添加SSH
- github 设置SSH KEY
- github设置SSH
- github设置添加SSH
- Android gps数据上报(基于gps_quem.c)
- 关于setitem
- Android GPS架构分析
- Tyvj Q1033(线性扫描)
- ZOJ 2314 上下界最大流
- github 设置
- 查看警告日志(alter_<sid>.log)所在位置
- C++ 文件结束符
- Mysql连接问题
- ACM 总结
- rpm卸载mysql
- 三种方法实现弹出框边框半透明和圆角的效果
- 计算一个字符串中的数字,字母,标点数
- Adobe Dreamweaver CS5 简体中文绿色版