本文主要是介绍Github基本操作【学习笔记】,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
Set Up Git配置全局用户名
git config --global user.name "Your Name Here"
配置全局邮箱
git config --global user.email "your_email@example.com"
配置全局邮箱
Create A Repo
More about repositories
Click New Repository.
Click "New Repository
Fill out the information on this page. When you're done, click "Create Repository."
Fill in the info
Congratulations! You have successfully created your first repository!
远程仓库建立后,在本地建立项目
mkdir ~/Hello-World
# Creates a directory for your project called "Hello-World" in your user directory
cd ~/Hello-World
# Changes the current working directory to your newly created directory
git init
# Sets up the necessary Git files
# Initialized empty Git repository in /Users/you/Hello-World/.git/
touch README
# Creates a file called "README" in your Hello-World directory
提交指定的文件
git add README
# Stages your README file, adding it to the list of files to be committed
git commit -m 'first commit'
# Commits your files, adding the message "first commit"
将本地动作提交到远程仓库
git remote add origin https://github.com/username/Hello-World.git
# Creates a remote named "origin" pointing at your GitHub repository
git push origin master
# Sends your commits in the "master" branch to GitHub
发现无法提交,解决办法直接暴力上传
To https://github.com/kelespring/test.git
! [rejected] master -> master (fetch first)
error: failed to push some refs to 'https://github.com/kelespring/test.git'
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first integrate the remote changes
hint: (e.g., 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
git push -f
讲远程仓库下载到本地
git clone https://github.com/username/Spoon-Knife.git
先写到这里
这篇关于Github基本操作【学习笔记】的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!