git 入门教程&一个冒号引发的git惨案

394 阅读2分钟

本文已参与「新人创作礼」活动,一起开启掘金创作之路。

Git is a version control system.
Git is free software.

Git Tutorials

Git introduction

Git is a version control system.

it's free

Git install

sudo apt install git 

Installation package link is here

then, configure it

git config --global user.name "your name"
git config --global user.email "xxx@xx.com"

git create repository

 git init  
 #Create empty Git repo in specified directory. Run with no arguments to initialize the current directory as a git repository.
git status #
git add <directory> #
git commit -m "message" 
git basics解释explanation text
git init 在指定的⽬录下创建⼀个空的git repo。不带参数将在当前⽬录下创建⼀个git repo。Create empty Git repo in specified directory. Run with no arguments to initialize the current directory as a git repository.
git clone 克隆⼀个指定repo到本地。指定的repo可以是本地⽂件系统或者由HTTP或SSH指定的远程路径。Clone repo located at onto local machine. Original repo can be located on the local filesystem or on a remote machine via HTTP or SSH.
git config user.name 针对当前repo配置⽤户名。使⽤--global 参数将配置全局⽤户名。Define author name to be used for all commits in current repo. Devs commonly use --global flag to set config options for current user.
git add 将指定目录下的所有修改加入到下一次commit 中。把替换成将添加指定⽂件的修改。Stage all changes in for the next commit. Replace with a to change a specific file.

一个冒号引发的git惨案

问题描述:本来是早上在学习ros时,遇到一个错误,于是在Ubuntu端写了一篇博客。名为error:error-run_depend.md,晚上在windows端再次写博客时首先需要将本地仓库更新一下,于是Git pull了一下,好家伙,出错了????

 juliusyang@juliusyang F:\my_notes\study-notes
 $git pull github master
From github.com:juliusyang97/study-notes
 * branch            master     -> FETCH_HEAD
error: invalid path 'ros/error:run_depend.md'

草,放弃了

学习要紧,赶紧解决

找到原因了:文件命名的问题,将文件名由error:run_depend.md改为error-run_depend.md 之后pull正常了。

问题解决了,就是引发的惨案

references:廖雪峰的官方网站-git教程