It's not pulling the right repository to move files I believe.
I am pretty sure I'm in the right directory.
It's 2:35 in the video I'm trying to follow along with - https://www.youtube.com/watch?v=0_-mP0RjsVI&t=164s
You are trying to push, not pull.
You would need to create the target remote repository first (https://github.com/Deanyboybopper/Tester.git)
If you have not created it, install the GitHub CLI gh, and create it from your workstation with gh repo create
cd /path/to/local/Tester
gh repo create --source
Related
Trying to deploy internal development from GitHub to a Centos 7 webserver, running into 2 issues.
Firstly, I'm using PHP and need to deploy the class files to a folder that is not /var/www/html/, where I have cloned the repository to using
cd /var/www/
gh repo clone linkto/repo html (this may be the wrong thing to do).
Secondly, Prompting me to think that I've done the first part wrong, when trying to use gh repo sync linkto/repo i get the error can't determine source repository for GitUser/home because repository is not fork leading me to believe that instead of cloning I need to fork it. My intention here is that no code would ever be changed on the server-side just updated on GitHub then push to the server. Am I trying to do too much with GitHub? or am I trying to do it wrong?
EDIT:
doing cd /var/www/html/ gh repo fork gh repo sync and setting a remote back to the origin has solved the second issue
Thanks,
In
cd /var/www/html/
Running once to setup:
gh repo fork with a remote set to the origin
Each time to update:
gh repo sync setting the base repository each time to update
Then using
https://git-scm.com/book/en/v2/Customizing-Git-Git-Hooks
a server-side post-receive hook to move the classes directory to the desired location
I have a big .NET solution with many projects. Everything is on Azure devops, and working well for the team.
Some of these projects are demo project.
I would like a way to publish the code of these demo projects on github, so they will be publicly available.
I'm looking for a way to publish the code of these specific projects to github.
Does anyone have a way to do that efficiently ?
if you are using any previous source control (ex TFS) first Unattache it ,
i presume you are using VS,
right click the solution then select "Add solution to source control "
since VS 2015 , GitHub is integrated out of the box , log in to your GitHub account(if you are using an older version just download it as an extension )
Below are the visuals
Create a new folder.
Copy to this folder only the projects you want to publish on GitHub.
Create a new Git repo:
git init
git add .
git commit -m "first commit"
Create a new repo on GitHub:
Open cmd and push the new local repo to new GitHub repo.
cd path/to/your-new-folder
git remote add origin https://github.com/{your-user-name}/demo-projcets.git
git push -u origin master
I am new to GitHub and I have to submit one assignment through GitHub.
I have been reading this blog for uploading files through github, but am not able to see any button labeled Upload files on my home screen of the repository
What am I missing?
See the "or push an existing repository from the command line" to push existant files to your repository. You won't have to load them by a form but with your command line from your project.
Github does not work like cloud storage platform. You actually need to have git installed on your computer in order to be able to push code to your repositories.
First of all, you need to install git( download links here ).
Then you need to init your local repositories with git init. Caution you need to run this command inside the directory your code is placed.
Run git add --all to stage the changes
Run git commit -m "your message" to commit your changes
Run git add remote origin (repo_link or ssh) to add your Github repo as a remote repository
Run git push -u origin master to push your master branch to remote origin
This might look a lot at first place but, you 'll get used to it really soon
Alternative
You can also the git and GitHub GUI which are much friendlier for a beginner.
How can I upload folders to GitHub? I have all of my code in a folder, containing 98 files, on my desktop. I know how to upload files, but it there a way to upload the entire folder?
Thanks!
This is Web GUI of a GitHub repository:
Drag and drop your folder to the above area. When you upload too much folder/files, GitHub will notice you:
Yowza, that’s a lot of files. Try again with fewer than 100 files.
and add commit message
And press button Commit changes is the last step.
You can also use the command line, Change directory where your folder is located then type the following :
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
I Understand where you are coming from.
The solution provided by #James Graham may not work in certain cases. The Drag and Drop Functionality may cease to exist. See below link when that happens:
https://www.reddit.com/r/github/comments/meuxtg/github_drag_and_drop_not_working/
If somebody wants to avoid the shell and all the commands and wants to have a UI to do that,Github Desktop is one of the way to go forward.
Steps to follow to install and use Github Desktop:
I am assuming you know the difference between local repo and remote repo
Install Github Desktop
Create a repository locally on your hard drive by using github desktop. This will automatically create files like .git and .gitattributes. It also asks to create a README.md file, always best practice is to create it and edit it informing readers about your project overview, installation steps etc. README.md is rendered in Markdown and can also render HTML. See more about Markdown here: Markdown Cheatsheet guide
Copy and Paste all the folders and files that you want to upload(basically the right terminology is "Push" ) into this newly created local repository. Be aware of the directory structure as the exact same directory structure will be replicated on your remote repository.
Go to github desktop, as soon as you paste files in the local repo, you will see them as changes here. All you need to do is commit these changes with a comment. This will be your "First or Initial Commit" to the repo.
Next Github repo will ask whether you want to publish these to its remote repository. Click "Publish" Note Publish is just a one time operations. Going forward any further changes you make to local repo will be seen in github desktop and you need to again follow the loop of "Commit local->Fetch from remote->Push to Remote. As long as you are the only developer working on a project you need not go into other mechanics of git branches etc.
To verify if your repo is published remotely login to your github profile on the web and see your repository sitting there. This your remote repo which you effectively created from your local repo by using Github desktop.
I've just gone through that process again. Always end up cloning the repo locally, upload the folder I want to have in that repo to that cloned location, commit the changes and then push it.
Note that if you're dealing with large files, you'll need to consider using something like Git LFS.
For those still using master, this was changed to main
echo "# repo-name" >> README.md
git init
git add README.md
git commit -m "first commit"
git branch -M main
git remote add origin https://github.com/username/repo-name.git
git push -u origin main
I have a project which I want to upload to GitHub. I have used Github Desktop to create a local repository and I am able to commit files to it. But once I try to publish it, the publish icon just fades and won't allow me to do it. I have checked my settings in Settings->Options and they are correct.
Since the local repo has no remote url, you need to add one, referencing a remote empty repo that you own (on GitHub for instance):
cd /path/to/repo
git remote add origin https://github.com/<user>/<an_empty_repo>
Or, in GitHub Desktop:
Settings->Repository settings->Remote
Then you will be able to publish.