Wednesday, April 14, 2021

Starting a new GitHub project from CLI



$ mkdir github_test

$ cd github_test
$ echo "Hello" > test.txt

$ ls
test.txt

$ git init

Initialized empty Git repository in /home/administrator/Desktop/github_test/.git/

$ git add -A

$ git status

On branch master
No commits yet
Changes to be committed:
  (use "git rm --cached <file>..." to unstage)
	new file:   test.txt

$ git commit -m "1654"

[master (root-commit) f571b69] 1654
1 file changed, 1 insertion(+)
create mode 100644 test.txt
 
$ git status

On branch master
nothing to commit, working tree clean 

$ ls
test.txt

$ ls -la

total 16
drwxrwxr-x 3 administrator administrator 4096 Apr 13 16:54 .
drwxr-xr-x 4 administrator administrator 4096 Apr 13 16:53 ..
drwxrwxr-x 8 administrator administrator 4096 Apr 13 16:54 .git
-rw-rw-r-- 1 administrator administrator    6 Apr 13 16:54 test.txt

$ ls -laR

.:
total 16
drwxrwxr-x 3 administrator administrator 4096 Apr 13 16:54 .
drwxr-xr-x 4 administrator administrator 4096 Apr 13 16:53 ..
drwxrwxr-x 8 administrator administrator 4096 Apr 13 16:54 .git
-rw-rw-r-- 1 administrator administrator    6 Apr 13 16:54 test.txt

./.git:
total 52
...
...
drwxrwxr-x 4 administrator administrator 4096 Apr 13 16:54 ..


$ git remote add origin https://github.com/${username}/test2.git

$ git branch

* master

$ git push origin master

Username for ...
Password for ...
remote: Invalid username or password.
fatal: Authentication failed for ....

= = = = = = = = = 

Intructions from GitHub portal

Quick setup — if you’ve done this kind of thing before
or	
https://github.com/${username}/test2.git
Get started by creating a new file or uploading an existing file. We recommend every repository include a README, LICENSE, and .gitignore.

…or create a new repository on the command line
echo "# test2" >> README.md
git init
git add README.md
git commit -m "first commit"
git branch -M main
git remote add origin https://github.com/${username}/test2.git
git push -u origin main

…or push an existing repository from the command line
git remote add origin https://github.com/${username}/test2.git
git branch -M main
git push -u origin main

…or import code from another repository
You can initialize this repository with code from a Subversion, Mercurial, or TFS project.
Tags: Technology,GitHub,

No comments:

Post a Comment