Git - Importing Project 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
2
Q
Adding an existing project to Github using the command line
A
- 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.
- Initialise local directory as git repo
git init - Add files in your new local repo, this stages them for first commit.
git add .
(To unstage use git reset HEAD YOUR-FILE) - 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. - 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)
- 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)