-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGit_tutorial_Linux.txt
More file actions
54 lines (42 loc) · 1.61 KB
/
Copy pathGit_tutorial_Linux.txt
File metadata and controls
54 lines (42 loc) · 1.61 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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
Installation
sudo apt install git
git --version #to check verison
Configuration
git config --global user.name "YOUR_USERNAME" #add username
git config --global user.email "YOUR@EMAIL” #add email
git config --list #verify configuration
Create Repository on GitHub account
Using Git with Local and Remote Repositories
mkdir foldername
cd foldername
git init #initiates git in that folder
Connect remote GitHub repository to the local system
git remote add origin https://github.com/YOUR_GIT_REPO.git #paste the link to your repo that you made
Test File
Create a file in the folder that you made
vim Hello.java
Add code to the file
package test;
public class Hello {
public static void main(String[] args) {
System.out.println("hello");
}
}
Using Git
Adds change in the working directory
git add Hello.java
Commit changes
git commit -m "Add Hello.java"
Push changes
git push origin master
Provide your GitHub username and password
Create Token Access
Go to github Settings > Developer Settings > Personal access Tokens> Tokens > Generate new token(Classic)
Add Note(Name of access token)
Select scopes (tick repo)
Generate token
Add username and Acess token
Cloning a Repository
Make folder
mkdir foldername
git clone https://github.com/YOUR_USERNAME/YOUR_REPO.git