nerdexam
Cisco

300-435 · Question #21

A new project called "device_status" must be stored in a central Git repository called "devops_status" with the first file named "device_status.py". The Git repository is created using the account…

The correct answer is A. git init git add device_status.py git commit -m "Initial Revision" git remote add origin \ https://git.cisco.com/python_programmer/device_status.git git push -u origin master. The correct sequence of Git commands for an initial project push involves initializing the repository, staging and committing files, adding a remote origin, and then pushing the local branch to the remote.

Network Automation Foundation

Question

A new project called "device_status" must be stored in a central Git repository called "devops_status" with the first file named "device_status.py". The Git repository is created using the account python_programmer. Which set of commands inserts the project into Git?

Options

How the community answered

(61 responses)
  • A
    90% (55)
  • B
    2% (1)
  • C
    3% (2)
  • D
    5% (3)

Why each option

The correct sequence of Git commands for an initial project push involves initializing the repository, staging and committing files, adding a remote origin, and then pushing the local branch to the remote.

Agit init git add device_status.py git commit -m "Initial Revision" git remote add origin \ https://git.cisco.com/python_programmer/device_status.git git push -u origin masterCorrect

This sequence correctly initializes a new Git repository (`git init`), stages the file (`git add`), commits it locally (`git commit`), associates the local repository with the remote URL (`git remote add origin`), and finally pushes the master branch to the remote, setting it as the upstream tracking branch (`git push -u origin master`). This is the standard workflow for an initial project push.

Bgit init git remote add origin \ https://git.cisco.com/python_programmer/device_status.git git add device_status.py git pull

This sequence is incorrect because `git pull` is used to fetch and merge changes from a remote, which is not appropriate for an initial push where no history exists on the remote yet, and it misses the `git commit` step entirely.

Cgit init git remote add origin \ https://git.cisco.com/python_programmer/device_status.git git add device_status.py git commit -m "Initial Revision" git pull -u origin master

This sequence incorrectly uses `git pull -u origin master` after committing, which is typically for synchronizing with an existing remote; for an initial push, `git push` is required to send local changes to the remote.

Dgit init git add device_status.py git remote add python_programmer/device_status git push

This sequence is incorrect because `git remote add python_programmer/device_status` is missing the remote URL, and `git push` without specifying the remote and branch might fail or require prior configuration.

Concept tested: Git basic workflow - initial commit and push

Source: https://git-scm.com/docs/gittutorial

Topics

#Git#Version Control#Repository Initialization#Code Management

Community Discussion

No community discussion yet for this question.

Full 300-435 Practice