您的位置:首页 > 编程语言

Ubuntu 系统下使用 git 命令行交互 github

2017-10-31 10:00 579 查看
前言:

本文主要整理“Ubuntu 系统下使用 git 命令行交互 github”,但也会根据日常所需整理一些 windows OS 下遇到的一些问题。

Ubuntu 系统下使用 git 命令行交互 github:

=== 相关命令 ===

git init

git add .

git commit -m "注释"

git remote add origin https://url
git pull origin master

git push -u origin master

=== 上传代码(push )=== 

git add .

git commit -m "注释"     // 有可能需要你先执行 git config --global user.email "your email" 

git push -u origin master    // 注意:指定了origin master,当前目录要在对应仓库的根目录下。
输入github的账号和密码

示例如下所示:

hcq@hcq-home:~/document/github_daily/MachineLearning_DeepLearning$ git add .
hcq@hcq-home:~/document/github_daily/MachineLearning_DeepLearning$ git commit -m 'added rcnn-tflearn by hcq 20171128'

*** Please tell me who you are.

Run

git config --global user.email "you@example.com"
git config --global user.name "Your Name"

to set your account's default identity.
Omit --global to set the identity only in this repository.

fatal: unable to auto-detect email address (got 'hcq@hcq-home.(none)')
hcq@hcq-home:~/document/github_daily/MachineLearning_DeepLearning$ git config --global user.email "836999690@qq.com"
hcq@hcq-home:~/document/github_daily/MachineLearning_DeepLearning$ git commit -m 'added rcnn-tflearn by hcq 20171128'
[master 9eb87cf] added rcnn-tflearn by hcq 20171128
11 files changed, 2083 insertions(+)
create mode 100644 rcnn-tflearn/RCNN.md
create mode 100644 rcnn-tflearn/RCNN_output.py
create mode 100644 rcnn-tflearn/fine_tune_RCNN.py
create mode 100755 rcnn-tflearn/image_1173.jpg
create mode 100644 rcnn-tflearn/preprocessing_RCNN.py
create mode 100644 rcnn-tflearn/refine_list.txt
create mode 100644 rcnn-tflearn/svm_train/1.txt
create mode 100644 rcnn-tflearn/svm_train/2.txt
create mode 100644 rcnn-tflearn/testimg7.jpg
create mode 100644 rcnn-tflearn/train_alexnet.py
create mode 100644 rcnn-tflearn/train_list.txt
hcq@hcq-home:~/document/github_daily/MachineLearning_DeepLearning$ git push -u origin master
Username for 'https://github.com': 836999690@qq.com
Password for 'https://836999690@qq.com@github.com':
Counting objects: 15, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (15/15), done.
Writing objects: 100% (15/15), 108.42 KiB | 36.14 MiB/s, done.
Total 15 (delta 4), reused 0 (delta 0)
remote: Resolving deltas: 100% (4/4), done.
To https://github.com/Houchaoqun/MachineLearning_DeepLearning.git c3160ca..9eb87cf  master -> master
Branch 'master' set up to track remote branch 'master' from 'origin'.


=== 更新本地代码(pull )=== 

git pull origin master

.gitignore

*.DS_Store
*.pyc
*.py[cod]

如果使用了.gitignore文件仍存在冲突(如|“.pyc”),可能是仓库仍然缓存在一些“.pyc”,尝试使用如下命令删除这些缓存:
git rm --cached *.pyc

问题集锦:

【Windows系统新建gitignore文件出现“必须键入文件名”错误的解决办法】

referencehttps://www.cnblogs.com/stonefeng/p/5689550.html

描述:使用.gitignore文件把不需要做版本控制的文件排除出去,在项目的根目录下新建一个.gitignore文件。此时,当写好文件名并按下回车键的时候,windows OS 弹框提示“必须键入文件名”,也就是“.”的前面不能为空,后面会文件后缀。

解决步骤

1)在项目根目录下面创建gitignore.txt文件;

2)填写 gitignore.txt 文件的内容;

3)打开windows自带的命令行模式,如 powershell 或者 cmd 等,切换到 gitignore.txt 所在的目录下;

4)执行命令 ren gitignore.txt .gitignore,改变文件名。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  github Ubuntu 命令行 git