I'm trying to learn how to use GitHub Actions and I'm running into a small issue. When I run the code locally, the files created while python training/train.py is running are created in the correct folder. However, when I try to do the same thing with GitHub Actions, the files are only created when I choose to create them in the root directory rather than /training/outputs/. Is there a way to resolve this?
Here's my GitHub repository: https://github.com/JayThibs/github-actions-ml-template
I've figured out how to resolve this so I figured I should share here.
Since I am using CML (Continuous Machine Learning), I could simply include the following line in my GitHub Actions cml.yaml file:
cml-pr training/outputs/*
This is because cml does not push outputs to my code automatically.
Besides using cml-pr, you can also use the following github push manually:
git config --local user.email "action#github.com"
git config --local user.name "GitHub Action"
git add training/outputs/*
git commit --message "Commit training outputs"
git push
Please keep in mind that the latter solution won't handle merge conflicts gracefully if there is a race condition between several simultaneous runs.
Since the action will push files to your repository, it will trigger another GitHub Action if your action is triggered on push. To resolve this, simply add something like [skip ci] in your commit message and GitHub will prevent an action to be triggered. You can learn more about it here: https://github.blog/changelog/2021-02-08-github-actions-skip-pull-request-and-push-workflows-with-skip-ci/
0x2b3bfa0 on GitHub helped me resolve this issue, you can find our conversation here: https://github.com/iterative/cml/issues/658
Related
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.
First I have created one project in Eclipse and committed to my GitHub using below commands:git init
git add .
git commit -m "first commit"
git remote add origin URI of my repo
git push -u origin master
Then I modified one file in Eclipse and committed to GitHub from Eclipse through creating remote and giving the remote URI of the repo.
I added my team member through add collaborator.
Then he downloaded my project and made a change in a file in Eclipse.
Now, how can he push that modified file to my GitHub repository from within Eclipse?
We have done one thing. He created a remote and gave the URI of my repo. But still we are unable to commit that file.
You need to add your colleague as a collaborator. This can be done in the desired GitHub repo via Settings > Collaborators (you need to type in your password again). Afterwards they have those permissions.
UPDATE
Sorry and good morning ;)
I overlooked that you already added your partner as a collaborator. Another possible reason for your situation could be in the Temporary interaction limits where you can, amongst others, limit the interaction with your repo to prior contributors.
If that doesn't help. Please add some more informations about your colleague's git logs.
UPDATE 2
#Rahul K regarding your comment (which you better add to your question, for faster recognition), your colleague first needs to integrate the remote changes via git pull origin master in order to be able to push his or her changes afterwards. But be aware that he or she might need to migrate any conflicts to files both of you applied changes to.
Best regards, David
I have resolved the issue by cloning the repo in my local folder, adding the project to eclipse and changing the file committed.
Before that you have to add that person as a collaborator. So that he/she can clone your repo using the command below:
git clone "Path to the repository"
This is an old question but I'll like to say this to help others that might still be facing this same issue.
I also faced this issue with a friend. I already made him a collaborator but he couldn't push. What we did to solve it was to clone the repo using the ssh url instead. Then we set up authentication in git with ssh. And we were able push successfully.
If you already cloned the repo with the usual HTTPS url, you can change the remote origin url using the git remote set-url origin <url> command but url here will be the ssh url.
I uploaded my whole project on my repository of github yesterday.
I'd like to update the online version today, and when I use git push -u origin masterorder, the bash window says:
! [rejected] master -> master (fetch first)
So how do I "fetch"?
If I use git pull first, would my local files be overwritten by the online version?
So how do I "fetch"?
By using the command:
git fetch
Basically, your local repo is out of sync with the remote (Github) repository. If you have multiple remote repos, you can specify which one, and you can also specify which branch. Try
git help fetch
for a complete description of the command and the various parameters you can pass in.
If I use git pull first, would my local files be overwritten by the online version?
git pull is like doing a git fetch followed by git merge -- that is, it gets the updates from the remote and attempts to merge those into your local files. That may be fine, or not, depending on what you intend. Read the help for both commands so that you can make an informed decision.
This is my first day at using GITHUB and I am stuck with this issue despite lot of googling. Her are the steps which I have done so far
cloned a repository
git clone https://github.com/OfficeDev/Complete-Me-Code-Sample.git
Now since I don't want to corrupt the main branch, I created my own branch
git branch validation
Now I switched to my branch
git checkout validation
Now I made all my changes locally. After this I created the remote branch
git remote add validation https://github.com/OfficeDev/Complete-Me-Code-Sample.git
Now I try to uploaded all my code
git push complete-me-code-sample validation
it asks me for user name and password and then gives me an error
fatal: 'complete-me-code-sample' does not appear to be a git repository
fatal: Could not read from remote repository.
Please make sure you have the correct access rights and the repository exists.
But isn't git open for everyone? or do I need to contact the owner of this project and ask for rights? if yes, what rights I should ask for?
At this point of time, I am finding too much information and its hard for me to proceed without doing a PHD.
Can you please tell me how I can checkin my code ... as well as point me to a resource which can teach me git without too much RTFM.
Your error is simple and it's git related, not github. Here it is:
Now I made all my changes locally. After this I created the remote branch
git remote add validation https://github.com/OfficeDev/Complete-Me-Code-Sample.git
This is not how you create a remote branch, in here you've added another origin (named validation), which basically is another clone of the same repo. You said that other repo is located at that address which is not true, as nothing exists there.
When you git push if the remote branch doesn't exist it is created by default, so if you simply skipped that step the branch would have been created fine.
The correct and optimised steps should have been:
git clone https://github.com/OfficeDev/Complete-Me-Code-Sample.git
// Creates and changed branch at the same time
git checkout -b validation
// You'll need to commit files first, just in case you missed that
git commit -am "my sample commit"
// Depending on how you set up the repo git push could be enough
git push origin validation
Try this and let me know how it went.
Still new to Github and was wondering if its possible to synchronize a WWW specific folder to Github project folder.
Let's say, I am working on /www/my-project/ and I have github folder /github/my-project-repo/
The main question is, how can I easily move file from my-project to my-project-repo just similarly to committing. Copy-pasting seems like a dull method to do. Any tips helps!
Use the --git-dir and --work-tree option of the git command:
If you are modifying files in my_project, but want them taken into account in my-project-repo git repo, you can do:
git --work-tree=/www/my-project/ --git-dir= /github/my-project-repo/.git status
git --work-tree=/www/my-project/ --git-dir= /github/my-project-repo/.git add -A .
git --work-tree=/www/my-project/ --git-dir= /github/my-project-repo/.git commit -m "add files from my-project"
You might want to refresh your working tree in /github/my-project-repo after modifying its index with your git add.
cd /github/my-project-repo
git checkout .
Beware though of concurrent modifications you could have on common files: that last checkout would erase and overwrite them by what you added from /www/my-project.
If you want to be sure to preserve any work in progress in /github/my-project-repo:
git stash save --keep-index
git stash drop
The OP found a simpler solution, and:
moved the storage directory to /www/.
cd /my-project/,
git config, git init, etc.
I stop tracking the repo that was save on Docs/Github/ — my first storage directory.
Finally figure it out... Here are some video tutorial that helped me along the way:
http://www.youtube.com/watch?feature=player_embedded&v=mYjZtU1-u9Y
Basic fundamentals of Git
The difference between Git and GitHub
Installation and setup tutorial for Git
Basic (but core) command lines of Git
http://www.youtube.com/watch?feature=player_embedded&v=8r_IErxmoUc
Account signup tutorial for GitHub and general tips
Using GitHub with Git (configuration and demo)
Installation tutorial of GitHub Windows Client (GUI)
Introduction to Branching, Merging, Cloning, and Forking
http://www.youtube.com/watch?feature=player_embedded&v=STJBFXskfCc
Example of development cycle using Git and GitHub
More details on Branching, Merging, Cloning, and Forking
Introduction to Merging Conflicts
http://www.youtube.com/watch?v=LCv2BIQpPgI&feature=player_detailpage
In-depth look in Merging Conflicts
Tagging
Reverting Commits