Git - Importing Project Flashcards

You may prefer our related Brainscape-certified flashcards:
1
Q

What information should not be added to git repository.

A

Sensitive information such as:

Passwords
SSH Keys
AWS access keys
API keys 
Credit card numbers 
PIN numbers
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Adding an existing project to Github using the command line

A
  1. Create a new repository on github (to avoid errors do not inititialize project with readme or gitignore file these can be added after project has been pushed to github.
  2. Initialise local directory as git repo
    git init
  3. Add files in your new local repo, this stages them for first commit.
    git add .
    (To unstage use git reset HEAD YOUR-FILE)
  4. Commit the files you’ve staged in your local repository
    git commit -m “First Commit”
    (Commits tracked changes and prepares to be pushed to remote repository. To remove this commit and modify file use: git reset —soft HEAD~1 and commit and add file again.
  5. At top of github repository quick set-up page click to copy remote repository URL
6. In terminal add the URL for remote repository where your local repository will be pushed. 
git remote add origin 
(Sets the new remote)
git remote -v
(Verifies the new remote URL)
  1. Push the changes in your local repository to GitHub
    git push -u origin master
    (Pushes the changes in your local repository up to the remote repository you specified as the origin)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly