Monday, September 02, 2019

git first check in

Create a project in the github.com.
Let say I create a project "rss-admin"

PS D:\dvp\rssnews\rssproject> git init
Initialized empty Git repository in D:/dvp/rssnews/rssproject/.git/
PS D:\dvp\rssnews\rssproject> echo "#rss-admin" >> README.md
PS D:\dvp\rssnews\rssproject> git add --all
PS D:\dvp\rssnews\rssproject> git commit -m "first commit"
[master (root-commit) d3131a5] first commit
 31 files changed, 316 insertions(+)
 create mode 100644 README.md
 create mode 100644 db.sqlite3
 create mode 100644 manage.py
 create mode 100644 rss/__init__.py
 create mode 100644 rss/__pycache__/__init__.cpython-37.pyc
 ...
PS D:\dvp\rssnews\rssproject> git remote add origin https://github.com/ccapeng/rss-admin.git
PS D:\dvp\rssnews\rssproject> git remote -v
origin  https://github.com/ccapeng/rss-admin.git (fetch)
origin  https://github.com/ccapeng/rss-admin.git (push)
PS D:\dvp\rssnews\rssproject> git push -u origin master
...



Some notes :
1. Avoid to check python runtime file (*.pyc), before commit.
Create .gitignore like

__pycache__/
*.pyc
/env
*.bak

2. what if I enter the wrong git repository?
Try to correct it :
git remote set-url origin https://github.com/ccapeng/rss-admin.git

No comments: