SCM - Lab - Q 7 - Path in the hint

hi

In DevOps pre-requisite under module SCM - Lab - Q7 there I believe there is problem in hint provided .

Q: In your cloned repository i.e /home/thor/remoterepo create a file index.html with content This is a sample file . Track the new file, commit the changes and finally push the same to remote repo in master branch.

Check

info_outline Hint

Use below mentioned commands:

cd /home/thor

Create the index.html file and add the content as asked in the question.

git add index.html

git commit -m 'your commit message'

git push origin master

======================================================================

In my view the hint is stating " cd /home/thor which is not correct
It should be `cd /home/thor/remoterepo then only it will work .

I have added output form my working as below.


hor@host01 ~$ tree
.β”œβ”€β”€ remoterepo
β”‚   └── newfile└── webapp-color
    β”œβ”€β”€ app.py    β”œβ”€β”€ Dockerfile
    β”œβ”€β”€ requirements.txt    └── templates
        └── hello.html
3 directories, 5 filesthor@host01 ~$
thor@host01 ~$thor@host01 ~$ pwd
/home/thorthor@host01 ~$
thor@host01 ~$ cd remoterepo/thor@host01 ~/remoterepo$
thor@host01 ~/remoterepo$ echo "This is a sample file." > index.htmlthor@host01 ~/remoterepo$
thor@host01 ~/remoterepo$ pwd/home/thor/remoterepo
thor@host01 ~/remoterepo$thor@host01 ~/remoterepo$ pwd
/home/thor/remoterepo
thor@host01 ~/remoterepo$ ls -al
total 20
drwxrwxr-x 3 thor thor 4096 Jan 13 23:55 .
drwx------ 1 thor thor 4096 Jan 13 23:52 ..
drwxrwxr-x 8 thor thor 4096 Jan 13 23:52 .git
-rw-rw-r-- 1 thor thor   23 Jan 13 23:55 index.html
-rw-rw-r-- 1 thor thor    9 Jan 13 23:52 newfile
thor@host01 ~/remoterepo$
thor@host01 ~/remoterepo$ git status
# On branch master
# Untracked files:
#   (use "git add <file>..." to include in what will be committed)
#
#       index.html
nothing added to commit but untracked files present (use "git add" to track)
thor@host01 ~/remoterepo$
thor@host01 ~/remoterepo$ git add index.html
thor@host01 ~/remoterepo$
thor@host01 ~/remoterepo$ git commit -m "Intial commit" index.html
[master 5d4e8d8] Intial commit
 1 file changed, 1 insertion(+)
 create mode 100644 index.html
thor@host01 ~/remoterepo$
thor@host01 ~/remoterepo$ git status
# On branch master
# Your branch is ahead of 'origin/master' by 1 commit.
#   (use "git push" to publish your local commits)
#
nothing to commit, working directory clean
thor@host01 ~/remoterepo$
thor@host01 ~/remoterepo$ pwd
/home/thor/remoterepo
thor@host01 ~/remoterepo$
thor@host01 ~/remoterepo$
thor@host01 ~/remoterepo$
thor@host01 ~/remoterepo$ git remote -v
origin  /opt/remoterepo.git (fetch)
origin  /opt/remoterepo.git (push)
thor@host01 ~/remoterepo$
thor@host01 ~/remoterepo$ git push -u remoterepo master
fatal: 'remoterepo' does not appear to be a git repository
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
thor@host01 ~/remoterepo$ tree
.
β”œβ”€β”€ index.html
└── newfile

0 directories, 2 files
thor@host01 ~/remoterepo$ git --help
usage: git [--version] [--help] [-c name=value]
           [--exec-path[=<path>]] [--html-path] [--man-path] [--info-path]
           [-p|--paginate|--no-pager] [--no-replace-objects] [--bare]
           [--git-dir=<path>] [--work-tree=<path>] [--namespace=<name>]
           <command> [<args>]

The most commonly used git commands are:
   add        Add file contents to the index
   bisect     Find by binary search the change that introduced a bug
   branch     List, create, or delete branches
   checkout   Checkout a branch or paths to the working tree
   clone      Clone a repository into a new directory
   commit     Record changes to the repository
   diff       Show changes between commits, commit and working tree, etc
   fetch      Download objects and refs from another repository
   grep       Print lines matching a pattern
   init       Create an empty Git repository or reinitialize an existing one
   log        Show commit logs
   merge      Join two or more development histories together
   mv         Move or rename a file, a directory, or a symlink
   pull       Fetch from and merge with another repository or a local branch
   push       Update remote refs along with associated objects
   rebase     Forward-port local commits to the updated upstream head
   reset      Reset current HEAD to the specified state
   rm         Remove files from the working tree and from the index
   show       Show various types of objects
   status     Show the working tree status
   tag        Create, list, delete or verify a tag object signed with GPG

'git help -a' and 'git help -g' lists available subcommands and some
concept guides. See 'git help <command>' or 'git help <concept>'
to read about a specific subcommand or concept.
thor@host01 ~/remoterepo$ git push --help
warning: failed to exec 'man': No such file or directory
fatal: no man viewer handled the request
thor@host01 ~/remoterepo$
thor@host01 ~/remoterepo$ git push origin master
Counting objects: 4, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 292 bytes | 0 bytes/s, done.
Total 3 (delta 0), reused 0 (delta 0)
To /opt/remoterepo.git
   e70a258..5d4e8d8  master -> master
thor@host01 ~/remoterepo$
thor@host01 ~/remoterepo$ git status
# On branch master
nothing to commit, working directory clean
thor@host01 ~/remoterepo$
thor@host01 ~/remoterepo$ pwd
/home/thor/remoterepo
thor@host01 ~/remoterepo$
thor@host01 ~/remoterepo$ Connection to host01 closed by remote host.
Connection to host01 closed.

The environment has expired.

Please refresh to get a new environment.

1 Like

Great! @ppnehe.
Thanks for sharing your experience.