-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcommands_used
More file actions
38 lines (27 loc) · 1.42 KB
/
commands_used
File metadata and controls
38 lines (27 loc) · 1.42 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
BASIC GIT COMMANDS
Install git using:
sudo apt-get install git
After downloading, first configure git by giving username and email of your git account on github.com or bitbucket.org:
git config --global user.name 'saurabhs92'
git config --global userm.email 'saurabhs92@gmail.com'
Go to github.com or bitbucket.org and create a new repository. For example create git-test repo on github.com
Make a folder for your repo in your system. Ex:
mkdir gittest
Inside that folder initialize git:
git init
(Creates .git hidden folder containing files required by github. Check using ls -a or cd .git/)
To push a file for the FIRST time: Example add a README file to the repository:
emacs README (Add a description for your repository and save the file)
git add .
git commit -m 'First commit' (-m stands for message)
To finally add these files to your repository, first link them using: use git remote add origin https://github.com/<username>/<repository name>.git For example:
git remote add origin https://github.com/saurabhs92/git-test.git
Finally push the files to the master branch:
git push origin master
(Provide username and password at the prompt)
To push a 2nd file to the repo, for example the file commands_used:
emacs commands_used (Edit and Save the file)
git add .
git commit -m 'Second commit, added file commands_used'
git push origin master
(Provide username and password)