Joaquín, miembro de este equipo de trabajo, nos hizo el favor de escribir esta sección ya que domina a la perfección este tema.
Ejemplo 1: cómo crear una carpeta en github
You cannot create an empty folder and then add files to that folder,
but rather creation of a folder must happen together with adding of
at least a single file.OnGitHub you can do it this way:Go to the folder inside which you want to create another folder
Click on New file
On the text field for the file name, first write the folder
name you want to create
Then type /.This creates a folder
You can add more folders similarly
Finally, give the newfile a name(for example,.gitkeep which is conventionally used
to make Git track otherwise empty folders; it is
not a Git feature though)Finally, click Commitnewfile.
Ejemplo 2: agregar carpeta a la línea de comandos de github
# 1)Create a newrepository on GitHub.
# To avoid errors,do not initialize the newrepositorywithREADME, license, or gitignore files.You can add these files after your project has been pushed to GitHub.
# 2)OpenTerminal.
# 3)Change the current working directory to your local project.
# 4)Initialize the local directory as a Git repository.$ git init
# 5)Add the files in your newlocal repository.
# This stages them for the first commit.$ git add .
# 6)Adds the files in the local repository and stages them for commit.
# To unstage a file, use 'git reset HEAD YOUR-FILE'.
# Commit the files that you've staged in your local repository.$ git commit -m "First commit"
# 7)Commits the tracked changes and prepares them to be pushed to a remote
# repository.
# To remove this commit and modify the file, use 'git reset --soft HEAD~1' and
# commit and add the file again.
# 8)At the top of your GitHub repository's QuickSetup page, click to copy
# the remote repository URL.
# 9)Copy remote repository URL field
# 10)InTerminal, add the URLfor the remote repository where your local repository will be pushed.$ git remote add origin **remote repository URL**
# Sets the newremote
$ git remote -v
# Verifies the newremoteURL
# 11)Push the changes in your local repository to GitHub.$ git push -u origin main
# Pushes the changes in your local repository up to the remote repository you specified as the origin
Ejemplo 3: github agregar directorio al repositorio
git init
git add <folder1><folder2><etc.>
git commit -m "Your message about the commit"
git remote add origin https://github.com/yourUsername/yourRepository.git
git push -u origin master
git push origin master
Puedes añadir valor a nuestro contenido informacional asistiendo con tu veteranía en los comentarios.
¡Haz clic para puntuar esta entrada!
(Votos: 0 Promedio: 0)